From 9a9665f96e006602950e0e32ce80cb5ee14f5e5f Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 4 Jul 2006 09:22:49 +0200 Subject: * apt-pkg/depcache.cc: - create a empty state file if none exists --- apt-pkg/depcache.cc | 9 +++++++++ 1 file changed, 9 insertions(+) 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()); -- cgit v1.2.3