summaryrefslogtreecommitdiff
path: root/apt-pkg/pkgcachegen.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/pkgcachegen.cc')
-rw-r--r--apt-pkg/pkgcachegen.cc25
1 files changed, 21 insertions, 4 deletions
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc
index ebcbfdd25..2b6d294fb 100644
--- a/apt-pkg/pkgcachegen.cc
+++ b/apt-pkg/pkgcachegen.cc
@@ -98,6 +98,7 @@ pkgCacheGenerator::~pkgCacheGenerator()
return;
Cache.HeaderP->Dirty = false;
+ Cache.HeaderP->CacheFileSize = Map.Size();
Map.Sync(0,sizeof(pkgCache::Header));
}
/*}}}*/
@@ -645,7 +646,7 @@ bool pkgCacheGenerator::FinishCache(OpProgress *Progress)
bool const coInstall = ((V->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same);
for (vector<string>::const_iterator A = archs.begin(); A != archs.end(); ++A)
{
- if (*A == Arch)
+ if (Arch == 0 || *A == Arch)
continue;
/* We allow only one installed arch at the time
per group, therefore each group member conflicts
@@ -1182,16 +1183,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);