]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/acquire-worker.cc
get group again after potential remap in Source: parse
[apt.git] / apt-pkg / acquire-worker.cc
index d8bdf56990fe8adae190d24cf1a3c4886ea2b243..37804c67a098f585dadab54c018491299008a4cb 100644 (file)
 using namespace std;
 
 // Worker::Worker - Constructor for Queue startup                      /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-pkgAcquire::Worker::Worker(Queue *Q,MethodConfig *Cnf,
-                          pkgAcquireStatus *log) : d(NULL), Log(log)
+pkgAcquire::Worker::Worker(Queue *Q, MethodConfig *Cnf, pkgAcquireStatus *log) :
+   d(NULL), OwnerQ(Q), Log(log), Config(Cnf), Access(Cnf->Access),
+   CurrentItem(nullptr), CurrentSize(0), TotalSize(0)
 {
-   OwnerQ = Q;
-   Config = Cnf;
-   Access = Cnf->Access;
-   CurrentItem = 0;
-   TotalSize = 0;
-   CurrentSize = 0;
-
    Construct();
 }
                                                                        /*}}}*/
 // Worker::Worker - Constructor for method config startup              /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-pkgAcquire::Worker::Worker(MethodConfig *Cnf) : d(NULL), OwnerQ(NULL), Config(Cnf),
-                                               Access(Cnf->Access), CurrentItem(NULL),
-                                               CurrentSize(0), TotalSize(0)
+pkgAcquire::Worker::Worker(MethodConfig *Cnf) : Worker(nullptr, Cnf, nullptr)
 {
-   Construct();
 }
                                                                        /*}}}*/
 // Worker::Construct - Constructor helper                              /*{{{*/
@@ -639,7 +626,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);
    }
@@ -742,9 +729,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,
@@ -759,7 +746,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);
    }
 }
                                                                        /*}}}*/