X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/cce08fb5aca7dd01706cecea845b183dc62b1717..d27daedb6a0bf672508072100f20233d08ccf0e0:/apt-inst/extract.cc diff --git a/apt-inst/extract.cc b/apt-inst/extract.cc index 85363b9a1..026182c18 100644 --- a/apt-inst/extract.cc +++ b/apt-inst/extract.cc @@ -10,7 +10,7 @@ object is unpacked to '.dpkg.new' then the original is hardlinked to '.dpkg.tmp' and finally the new object is renamed to overwrite the old one. From an external perspective the file never ceased to exist. - After the archive has been sucessfully unpacked the .dpkg.tmp files + After the archive has been successfully unpacked the .dpkg.tmp files are erased. A failure causes all the .dpkg.tmp files to be restored. Decisions about unpacking go like this: @@ -22,7 +22,7 @@ [Note, this is reduced to only check if a file was expected to be there] - If the existing link/file is not a directory then it is replaced - irregardless + regardless - If the existing link/directory is being replaced by a directory then absolutely nothing happens. - If the existing link/directory is being replaced by a link then @@ -44,16 +44,26 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include #include #include -#include #include #include #include + #include /*}}}*/ using namespace std; @@ -76,10 +86,8 @@ pkgExtract::pkgExtract(pkgFLCache &FLCache,pkgCache::VerIterator Ver) : // Extract::DoItem - Handle a single item from the stream /*{{{*/ // --------------------------------------------------------------------- /* This performs the setup for the extraction.. */ -bool pkgExtract::DoItem(Item &Itm,int &Fd) +bool pkgExtract::DoItem(Item &Itm, int &/*Fd*/) { - char Temp[sizeof(FileName)]; - /* Strip any leading/trailing /s from the filename, then copy it to the temp buffer and re-apply the leading / We use a class variable to store the new filename for use by the three extraction funcs */ @@ -180,6 +188,7 @@ bool pkgExtract::DoItem(Item &Itm,int &Fd) // See if we can recover the backup file if (Nde.end() == false) { + char Temp[sizeof(FileName)]; snprintf(Temp,sizeof(Temp),"%s.%s",Itm.Name,TempExt); if (rename(Temp,Itm.Name) != 0 && errno != ENOENT) return _error->Errno("rename",_("Failed to rename %s to %s"), @@ -251,7 +260,7 @@ bool pkgExtract::DoItem(Item &Itm,int &Fd) // Extract::Finished - Sequence finished, erase the temp files /*{{{*/ // --------------------------------------------------------------------- /* */ -bool pkgExtract::Finished() +APT_CONST bool pkgExtract::Finished() { return true; } @@ -372,7 +381,6 @@ bool pkgExtract::HandleOverwrites(pkgFLCache::NodeIterator Nde, pkgFLCache::NodeIterator TmpNde = Nde; unsigned long DiverOwner = 0; unsigned long FileGroup = Nde->File; - const char *FirstOwner = 0; for (; Nde.end() == false && FileGroup == Nde->File; Nde++) { if ((Nde->Flags & pkgFLCache::Node::Diversion) != 0) @@ -392,12 +400,11 @@ bool pkgExtract::HandleOverwrites(pkgFLCache::NodeIterator Nde, if something has already been diverted by this diversion */ if (FPkg.Offset() == DiverOwner) continue; - FirstOwner = FPkg.Name(); - + // Now see if this package matches one in a replace depends pkgCache::DepIterator Dep = Ver.DependsList(); bool Ok = false; - for (; Dep.end() == false; Dep++) + for (; Dep.end() == false; ++Dep) { if (Dep->Type != pkgCache::Dep::Replaces) continue;