]> git.saurik.com Git - apt.git/commitdiff
create directory for extended_states if needed
authorDavid Kalnischkies <david@kalnischkies.de>
Fri, 14 Nov 2014 16:52:39 +0000 (17:52 +0100)
committerDavid Kalnischkies <david@kalnischkies.de>
Tue, 18 Nov 2014 01:41:20 +0000 (02:41 +0100)
Unlikely perhaps, but there is no guarantee that the directory we want
to drop the file into actually exists, so create it if we must.

apt-pkg/depcache.cc

index 1332f3ee20ad16f0f6dd43e981d29c76ba966392..25c945ebb10df6db7fbab55399f22208a5314e2f 100644 (file)
@@ -237,9 +237,11 @@ bool pkgDepCache::writeStateFile(OpProgress * /*prog*/, bool InstalledOnly)        /*{{
 
    FileFd StateFile;
    string const state = _config->FindFile("Dir::State::extended_states");
+   if (CreateAPTDirectoryIfNeeded(_config->FindDir("Dir::State"), flNotFile(state)) == false)
+      return false;
 
    // if it does not exist, create a empty one
-   if(!RealFileExists(state)) 
+   if(!RealFileExists(state))
    {
       StateFile.Open(state, FileFd::WriteAtomic);
       StateFile.Close();