summaryrefslogtreecommitdiff
path: root/apt-pkg/pkgcachegen.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-07-29 15:45:06 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2011-07-29 15:45:06 +0200
commit194fac6be95e698d8eec86ddf19ebc1e7ca6d5c7 (patch)
treeee446fd8a9ae1a184395ed339c71331437f51717 /apt-pkg/pkgcachegen.cc
parent64dda04bd949ab73ca77732fcc5149cc7c2a5557 (diff)
parentfc15861a405a0b0483bb8989e6a43215a86dba55 (diff)
merged from debian-sid
Diffstat (limited to 'apt-pkg/pkgcachegen.cc')
-rw-r--r--apt-pkg/pkgcachegen.cc22
1 files changed, 19 insertions, 3 deletions
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc
index ebcbfdd25..efd764b51 100644
--- a/apt-pkg/pkgcachegen.cc
+++ b/apt-pkg/pkgcachegen.cc
@@ -1182,16 +1182,32 @@ bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress
SPtr<DynamicMMap> Map;
if (Writeable == true && CacheFile.empty() == false)
{
+ _error->PushToStack();
unlink(CacheFile.c_str());
CacheF = new FileFd(CacheFile,FileFd::WriteAtomic);
fchmod(CacheF->Fd(),0644);
Map = CreateDynamicMMap(CacheF, MMap::Public);
if (_error->PendingError() == true)
- return false;
- if (Debug == true)
+ {
+ delete CacheF.UnGuard();
+ delete Map.UnGuard();
+ if (Debug == true)
+ std::clog << "Open filebased MMap FAILED" << std::endl;
+ Writeable = false;
+ if (AllowMem == false)
+ {
+ _error->MergeWithStack();
+ return false;
+ }
+ _error->RevertToStack();
+ }
+ else if (Debug == true)
+ {
+ _error->MergeWithStack();
std::clog << "Open filebased MMap" << std::endl;
+ }
}
- else
+ if (Writeable == false || CacheFile.empty() == true)
{
// Just build it in memory..
Map = CreateDynamicMMap(NULL);