diff options
author | David Kalnischkies <david@kalnischkies.de> | 2014-11-14 17:52:39 +0100 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2014-11-18 02:41:20 +0100 |
commit | 1b671a9ba2e42e43f4cb1be86dc052823cf6961f (patch) | |
tree | f901ea10c0ea2ad9c64b31b2e5116da85c8ce168 | |
parent | 081c9d442a6d39fb9bc419fe3ce697cc791cb844 (diff) |
create directory for extended_states if needed
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.
-rw-r--r-- | apt-pkg/depcache.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 1332f3ee2..25c945ebb 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -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(); |