X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/ae732225ec2fa0d7434c9f40a92ced8683752211..4c482ac554e1b533d98661de8585d5861d9ac562:/apt-pkg/acquire-worker.cc diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc index 45ee6dde3..c2ee8cda3 100644 --- a/apt-pkg/acquire-worker.cc +++ b/apt-pkg/acquire-worker.cc @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -463,15 +464,18 @@ bool pkgAcquire::Worker::RunMessages() OwnerQ->ItemDone(Itm); Itm = NULL; + bool errTransient; + { + std::string const failReason = LookupTag(Message, "FailReason"); + std::string const reasons[] = { "Timeout", "ConnectionRefused", + "ConnectionTimedOut", "ResolveFailure", "TmpResolveFailure" }; + errTransient = std::find(std::begin(reasons), std::end(reasons), failReason) != std::end(reasons); + } + for (pkgAcquire::Queue::QItem::owner_iterator O = ItmOwners.begin(); O != ItmOwners.end(); ++O) { - // set some status - if(LookupTag(Message,"FailReason") == "Timeout" || - LookupTag(Message,"FailReason") == "TmpResolveFailure" || - LookupTag(Message,"FailReason") == "ResolveFailure" || - LookupTag(Message,"FailReason") == "ConnectionRefused") + if (errTransient) (*O)->Status = pkgAcquire::Item::StatTransientNetworkError; - (*O)->Failed(Message,Config); if (Log != 0) @@ -635,7 +639,7 @@ bool pkgAcquire::Worker::QueueItem(pkgAcquire::Queue::QItem *Item) if (RealFileExists(Item->Owner->DestFile)) { - std::string SandboxUser = _config->Find("APT::Sandbox::User"); + std::string const SandboxUser = _config->Find("APT::Sandbox::User"); ChangeOwnerAndPermissionOfFile("Item::QueueURI", Item->Owner->DestFile.c_str(), SandboxUser.c_str(), "root", 0600); } @@ -738,9 +742,9 @@ void pkgAcquire::Worker::PrepareFiles(char const * const caller, pkgAcquire::Que for (pkgAcquire::Queue::QItem::owner_iterator O = Itm->Owners.begin(); O != Itm->Owners.end(); ++O) { pkgAcquire::Item const * const Owner = *O; - if (Owner->DestFile == filename) + if (Owner->DestFile == filename || filename == "/dev/null") continue; - unlink(Owner->DestFile.c_str()); + RemoveFile("PrepareFiles", Owner->DestFile); if (link(filename.c_str(), Owner->DestFile.c_str()) != 0) { // different mounts can't happen for us as we download to lists/ by default, @@ -755,7 +759,7 @@ void pkgAcquire::Worker::PrepareFiles(char const * const caller, pkgAcquire::Que else { for (pkgAcquire::Queue::QItem::owner_iterator O = Itm->Owners.begin(); O != Itm->Owners.end(); ++O) - unlink((*O)->DestFile.c_str()); + RemoveFile("PrepareFiles", (*O)->DestFile); } } /*}}}*/