diff options
-rw-r--r-- | apt-pkg/depcache.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 7663d3881..25a4372bf 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -186,6 +186,15 @@ bool pkgDepCache::writeStateFile(OpProgress *prog) FileFd StateFile; string state = _config->FindDir("Dir::State") + "extended_states"; + + // if it does not exist, create a empty one + if(!FileExists(state)) + { + StateFile.Open(state, FileFd::WriteEmpty); + StateFile.Close(); + } + + // open it if(!StateFile.Open(state, FileFd::ReadOnly)) return _error->Error(_("Failed to open StateFile %s"), state.c_str()); |