summaryrefslogtreecommitdiff
path: root/apt-pkg/depcache.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2006-07-04 09:22:49 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2006-07-04 09:22:49 +0200
commit9a9665f96e006602950e0e32ce80cb5ee14f5e5f (patch)
treea254741ea16955d481caba6789c42fd69ed6f03e /apt-pkg/depcache.cc
parent6b6afec3673bd1685e62a5c4b1803531a44add82 (diff)
downloadapt-9a9665f96e006602950e0e32ce80cb5ee14f5e5f.tar.gz
* apt-pkg/depcache.cc:
- create a empty state file if none exists
Diffstat (limited to 'apt-pkg/depcache.cc')
-rw-r--r--apt-pkg/depcache.cc9
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());