]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/acquire-item.cc
Use snprintf. Observed by Brian M. Hunt
[apt.git] / apt-pkg / acquire-item.cc
index 7ff3a58e9a766ba7f3650cd7ea122d129ac601d0..27e98283f90427c3b94fdfe85a6282cc5e6a062b 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: acquire-item.cc,v 1.44 2001/05/07 05:49:43 jgg Exp $
+// $Id: acquire-item.cc,v 1.46 2003/02/02 22:19:17 jgg Exp $
 /* ######################################################################
 
    Acquire Item - Item to acquire
@@ -121,11 +121,11 @@ void pkgAcquire::Item::Rename(string From,string To)
    if (rename(From.c_str(),To.c_str()) != 0)
    {
       char S[300];
-      sprintf(S,_("rename failed, %s (%s -> %s)."),strerror(errno),
+      snprintf(S,sizeof(S),_("rename failed, %s (%s -> %s)."),strerror(errno),
              From.c_str(),To.c_str());
       Status = StatError;
       ErrorText = S;
-   }      
+   }   
 }
                                                                        /*}}}*/
 
@@ -185,6 +185,7 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string MD5,
       string FinalFile = _config->FindDir("Dir::State::lists");
       FinalFile += URItoFileName(RealURI);
       Rename(DestFile,FinalFile);
+      chmod(FinalFile.c_str(),0644);
       
       /* We restore the original name to DestFile so that the clean operation
          will work OK */
@@ -312,6 +313,8 @@ void pkgAcqIndexRel::Done(string Message,unsigned long Size,string MD5,
    string FinalFile = _config->FindDir("Dir::State::lists");
    FinalFile += URItoFileName(RealURI);
    Rename(DestFile,FinalFile);
+   
+   chmod(FinalFile.c_str(),0644);
 }
                                                                        /*}}}*/
 // AcqIndexRel::Failed - Silence failure messages for missing rel files        /*{{{*/
@@ -348,7 +351,8 @@ pkgAcqArchive::pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources,
    if (Version.Arch() == 0)
    {
       _error->Error(_("I wasn't able to locate a file for the %s package. "
-                   "This might mean you need to manually fix this package. (due to missing arch)"),
+                     "This might mean you need to manually fix this package. "
+                     "(due to missing arch)"),
                    Version.ParentPkg().Name());
       return;
    }