summaryrefslogtreecommitdiff
path: root/apt-pkg/depcache.cc
diff options
context:
space:
mode:
authorMichael Vogt <egon@bottom>2006-07-25 16:06:42 +0200
committerMichael Vogt <egon@bottom>2006-07-25 16:06:42 +0200
commit5b1df5f0f00dff79fe3297270efa0626f80a02da (patch)
tree90f57cce740e6edcd443f44308b3b6390dd3a875 /apt-pkg/depcache.cc
parentdf78a81e47daa9de9d26f9bbc28708c8cd8fc6e4 (diff)
parenta4decc40b3eb085ea994d2a8b31ee9cddfd570ff (diff)
* merged with the current auto-mark branch
Diffstat (limited to 'apt-pkg/depcache.cc')
-rw-r--r--apt-pkg/depcache.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index 7663d3881..369eae70b 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());
@@ -242,6 +251,7 @@ bool pkgDepCache::writeStateFile(OpProgress *prog)
fprintf(OutFile,"\n");
}
}
+ fclose(OutFile);
// move the outfile over the real file
rename(outfile.c_str(), state.c_str());