]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/acquire-worker.cc
ensure lists/ files have correct permissions after apt-cdrom add
[apt.git] / apt-pkg / acquire-worker.cc
index 724bdfd49ee313e4e0a27fabc9ea21f23a8f05c3..bee01e6200777c5b2a5a6793b05b0cc63d5c91db 100644 (file)
 
 using namespace std;
 
-static void ChangeOwnerAndPermissionOfFile(char const * const requester, char const * const file, char const * const user, char const * const group, mode_t const mode) /*{{{*/
-{
-   if (getuid() == 0 && strlen(user) != 0 && strlen(group) != 0) // if we aren't root, we can't chown, so don't try it
-   {
-      // ensure the file is owned by root and has good permissions
-      struct passwd const * const pw = getpwnam(user);
-      struct group const * const gr = getgrnam(group);
-      if (pw != NULL && gr != NULL && chown(file, pw->pw_uid, gr->gr_gid) != 0)
-        _error->WarningE(requester, "chown to %s:%s of file %s failed", user, group, file);
-   }
-   if (chmod(file, mode) != 0)
-      _error->WarningE(requester, "chmod 0%o of file %s failed", mode, file);
-}
-                                                                       /*}}}*/
 // Worker::Worker - Constructor for Queue startup                      /*{{{*/
 // ---------------------------------------------------------------------
 /* */
@@ -346,28 +332,28 @@ bool pkgAcquire::Worker::RunMessages()
                               Owner->DestFile.c_str(), LookupTag(Message,"Size","0").c_str(),TotalSize);
 
            // see if there is a hash to verify
-           HashStringList RecivedHashes;
+           HashStringList ReceivedHashes;
            HashStringList expectedHashes = Owner->HashSums();
            for (HashStringList::const_iterator hs = expectedHashes.begin(); hs != expectedHashes.end(); ++hs)
            {
               std::string const tagname = hs->HashType() + "-Hash";
               std::string const hashsum = LookupTag(Message, tagname.c_str());
               if (hashsum.empty() == false)
-                 RecivedHashes.push_back(HashString(hs->HashType(), hashsum));
+                 ReceivedHashes.push_back(HashString(hs->HashType(), hashsum));
            }
 
            if(_config->FindB("Debug::pkgAcquire::Auth", false) == true)
            {
               std::clog << "201 URI Done: " << Owner->DescURI() << endl
-                 << "RecivedHash:" << endl;
-              for (HashStringList::const_iterator hs = RecivedHashes.begin(); hs != RecivedHashes.end(); ++hs)
+                 << "ReceivedHash:" << endl;
+              for (HashStringList::const_iterator hs = ReceivedHashes.begin(); hs != ReceivedHashes.end(); ++hs)
                  std::clog <<  "\t- " << hs->toStr() << std::endl;
               std::clog << "ExpectedHash:" << endl;
               for (HashStringList::const_iterator hs = expectedHashes.begin(); hs != expectedHashes.end(); ++hs)
                  std::clog <<  "\t- " << hs->toStr() << std::endl;
               std::clog << endl;
            }
-           Owner->Done(Message, ServerSize, RecivedHashes, Config);
+           Owner->Done(Message, ServerSize, ReceivedHashes, Config);
            ItemDone();
 
            // Log that we are done