2004-05-15 Dmitry V. Levin * apt-pkg/pkgcachegen.cc(pkgMakeStatusCache): Remove old sources cache file before creating new one. Fix error handling. --- apt-0.5.15cnc6/apt-pkg/pkgcachegen.cc.orig 2003-11-24 19:55:37 +0300 +++ apt-0.5.15cnc6/apt-pkg/pkgcachegen.cc 2004-05-15 19:10:23 +0400 @@ -805,10 +805,10 @@ bool pkgMakeStatusCache(pkgSourceList &L { unlink(CacheFile.c_str()); CacheF = new FileFd(CacheFile,FileFd::WriteEmpty); - fchmod(CacheF->Fd(),0644); - Map = new DynamicMMap(*CacheF,MMap::Public,MapSize); if (_error->PendingError() == true) return false; + fchmod(CacheF->Fd(),0644); + Map = new DynamicMMap(*CacheF,MMap::Public,MapSize); } else { @@ -902,10 +902,10 @@ bool pkgMakeStatusCache(pkgSourceList &L // even if using the sources cache (above). if (Writeable == true && SrcCacheFile.empty() == false) { + unlink(SrcCacheFile.c_str()); FileFd SCacheF(SrcCacheFile,FileFd::WriteEmpty); if (_error->PendingError() == true) return false; - fchmod(SCacheF.Fd(),0644); // Write out the main data