]> git.saurik.com Git - apt.git/commitdiff
* fix various -Wall warnings
authorMichael Vogt <michael.vogt@ubuntu.com>
Wed, 6 Aug 2008 12:01:29 +0000 (14:01 +0200)
committerMichael Vogt <michael.vogt@ubuntu.com>
Wed, 6 Aug 2008 12:01:29 +0000 (14:01 +0200)
* make "apt-get build-dep" installed packages marked automatic
  by default. This can be changed by setting the value of
  APT::Get::Build-Dep-Automatic to false (thanks to Aaron
  Haviland, closes: #44874, LP: #248268)

13 files changed:
apt-inst/contrib/extracttar.cc
apt-pkg/acquire.cc
apt-pkg/contrib/cdromutl.cc
apt-pkg/contrib/mmap.cc
apt-pkg/deb/dpkgpm.cc
apt-pkg/depcache.cc
apt-pkg/indexcopy.cc
cmdline/apt-cache.cc
cmdline/apt-get.cc
debian/changelog
doc/examples/configure-index
methods/http.cc
methods/https.cc

index 68c871a5daff23d592f12da559b59eb8d062d53c..8338fd89d2803e69b97775728a50e37eb660da67 100644 (file)
@@ -208,14 +208,14 @@ bool ExtractTar::Go(pkgDirStream &Stream)
         Itm.Name = (char *)LastLongName.c_str();
       else
       {
-        Tar->Name[sizeof(Tar->Name)] = 0;
+        Tar->Name[sizeof(Tar->Name)-1] = 0;
         Itm.Name = Tar->Name;
       }      
       if (Itm.Name[0] == '.' && Itm.Name[1] == '/' && Itm.Name[2] != 0)
         Itm.Name += 2;
       
       // Grab the link target
-      Tar->Name[sizeof(Tar->LinkName)] = 0;
+      Tar->Name[sizeof(Tar->LinkName)-1] = 0;
       Itm.LinkTarget = Tar->LinkName;
 
       if (LastLongLink.empty() == false)
index 6840ae120c4c9edd0a66043a0791aad1a05f6b16..91f60388959bce44a50ee81668b25d66e1e13e4a 100644 (file)
@@ -444,8 +444,9 @@ bool pkgAcquire::Clean(string Dir)
         unlink(Dir->d_name);
    };
    
-   chdir(StartDir.c_str());
    closedir(D);
+   if (chdir(StartDir.c_str()) != 0)
+      return _error->Errno("chdir",_("Unable to change to %s"),StartDir.c_str());
    return true;   
 }
                                                                        /*}}}*/
index 6f00e1451181ce72e8c17ea9551a6d27de38eaae..b6524a1785f48e0f258aaf2630460d617377dc55 100644 (file)
@@ -176,7 +176,8 @@ bool IdentCdrom(string CD,string &Res,unsigned int Version)
       Hash.Add(Dir->d_name);
    };
    
-   chdir(StartDir.c_str());
+   if (chdir(StartDir.c_str()) != 0)
+      return _error->Errno("chdir",_("Unable to change to %s"),StartDir.c_str());
    closedir(D);
    
    // Some stats from the fsys
index abcae46feee411e0beb7b7bd97a057bf7264ff7a..eed43825087407ccd989c6e4771357e52c86f0dd 100644 (file)
@@ -192,7 +192,8 @@ DynamicMMap::~DynamicMMap()
    unsigned long EndOfFile = iSize;
    iSize = WorkSpace;
    Close(false);
-   ftruncate(Fd->Fd(),EndOfFile);
+   if(ftruncate(Fd->Fd(),EndOfFile) < 0)
+      _error->Errno("ftruncate", _("Failed to truncate file"));
 }  
                                                                        /*}}}*/
 // DynamicMMap::RawAllocate - Allocate a raw chunk of unaligned space  /*{{{*/
@@ -209,7 +210,7 @@ unsigned long DynamicMMap::RawAllocate(unsigned long Size,unsigned long Aln)
    // Just in case error check
    if (Result + Size > WorkSpace)
    {
-      _error->Error("Dynamic MMap ran out of room");
+      _error->Error(_("Dynamic MMap ran out of room"));
       return 0;
    }
 
index a3f32e3c52b5895db73a3d22d817ef23cb0a1894..e1b3c6bc0076e4ef95049eea5099fd8fffd6603b 100644 (file)
@@ -498,7 +498,7 @@ bool pkgDPkgPM::OpenLog()
       struct tm *tmp = localtime(&t);
       strftime(outstr, sizeof(outstr), "%F  %T", tmp);
       fprintf(term_out, "\nLog started: ");
-      fprintf(term_out, outstr);
+      fprintf(term_out, "%s", outstr);
       fprintf(term_out, "\n");
    }
    return true;
@@ -513,7 +513,7 @@ bool pkgDPkgPM::CloseLog()
       struct tm *tmp = localtime(&t);
       strftime(outstr, sizeof(outstr), "%F  %T", tmp);
       fprintf(term_out, "Log ended: ");
-      fprintf(term_out, outstr);
+      fprintf(term_out, "%s", outstr);
       fprintf(term_out, "\n");
       fclose(term_out);
    }
index 8d8befbdfb72754957c550121fa64f69b38595b9..17864c76ca8614e96217cf072421856bc94ed004 100644 (file)
@@ -269,7 +269,7 @@ bool pkgDepCache::writeStateFile(OpProgress *prog, bool InstalledOnly)
         ostr.str(string(""));
         ostr << "Package: " << pkg.Name() 
              << "\nAuto-Installed: 1\n\n";
-        fprintf(OutFile,ostr.str().c_str());
+        fprintf(OutFile,"%s",ostr.str().c_str());
         fprintf(OutFile,"\n");
       }
    }
index b30777d8d28939e20a2493cc24a9dd7136ad652b..9e5c03e0b1ac065cbbc15eefe13446c607b1be52 100644 (file)
@@ -639,7 +639,7 @@ bool SigVerify::CopyAndVerify(string CDROM,string Name,vector<string> &SigList,
       // Open the Release file and add it to the MetaIndex
       if(!MetaIndex->Load(*I+"Release"))
       {
-        _error->Error(MetaIndex->ErrorText.c_str());
+        _error->Error("%s",MetaIndex->ErrorText.c_str());
         return false;
       }
       
index a73e35a53e78b66546a5deed987c83eace94752e..b16a0e5d0f8a6780207e6daa9b7c85e9f1031d58 100644 (file)
@@ -1276,7 +1276,7 @@ bool DisplayRecord(pkgCache::VerIterator V)
                                                                        /*}}}*/
 // Search - Perform a search                                           /*{{{*/
 // ---------------------------------------------------------------------
-/* This searches the package names and pacakge descriptions for a pattern */
+/* This searches the package names and package descriptions for a pattern */
 struct ExDescFile
 {
    pkgCache::DescFile *Df;
index 278404938f989540bf3c546da16dcf1a5a6756cd..bc9828db1e46e9ab500f4b208ff0184a88e87b15 100644 (file)
@@ -2540,6 +2540,8 @@ bool DoBuildDep(CommandLine &CmdL)
             {
                // We successfully installed something; skip remaining alternatives
                skipAlternatives = hasAlternatives;
+              if(_config->FindB("APT::Get::Build-Dep-Automatic", true) == true)
+                 Cache->MarkAuto(Pkg, true);
                continue;
             }
             else if (hasAlternatives)
index 91724d164e83ef4992b7a8e06e449cde65de0cd7..44fcb96fe9e6b5ad029f843fa241d99354cc5cd4 100644 (file)
@@ -1,3 +1,13 @@
+apt (0.7.14ubuntu5) intrepid; urgency=low
+
+  * fix various -Wall warnings
+  * make "apt-get build-dep" installed packages marked automatic
+    by default. This can be changed by setting the value of
+    APT::Get::Build-Dep-Automatic to false (thanks to Aaron 
+    Haviland, closes: #44874, LP: #248268)
+
+ -- Michael Vogt <michael.vogt@ubuntu.com>  Wed, 06 Aug 2008 14:00:51 +0200
+
 apt (0.7.14ubuntu4) intrepid; urgency=low
 
   [ Michael Vogt ]
@@ -15,7 +25,7 @@ apt (0.7.14ubuntu4) intrepid; urgency=low
     (thanks to Joey Hess) 
   * document --install-recommends and --no-install-recommends
     (thanks to Dereck Wonnacott, LP: #126180)
-
+  
   [ Dereck Wonnacott ]
   * apt-ftparchive might write corrupt Release files (LP: #46439)
   * Apply --important option to apt-cache depends (LP: #16947) 
index a6ad56067986a83c9f5b5abc6ff4de059d74095d..8e80a95a3160f2adf570fbd2efba289849e7b1b0 100644 (file)
@@ -54,6 +54,7 @@ APT
      Only-Source "";
      Diff-Only "false";
      Tar-Only "false";
+     Build-Dep-Automatic "true";
   };
 
   Cache 
index 61321c850210901bc409c2df44e08f5c852475d8..b0fb89fdacfcd1772e9a196afc0c2a3cafcf3ecc 100644 (file)
@@ -943,7 +943,8 @@ int HttpMethod::DealWithHeaders(FetchResult &Res,ServerState *Srv)
    if (Srv->StartPos >= 0)
    {
       Res.ResumePoint = Srv->StartPos;
-      ftruncate(File->Fd(),Srv->StartPos);
+      if (ftruncate(File->Fd(),Srv->StartPos) < 0)
+        _error->Errno("ftruncate", _("Failed to truncate file"));
    }
       
    // Set the start point
index e53ba1a115b57f704c94e3ac30a81c01ebf0c80a..98dfeefa10ad638673580f07e985828d9094b11c 100644 (file)
@@ -249,7 +249,7 @@ bool HttpsMethod::Fetch(FetchItem *Itm)
    if(success != 0) 
    {
       unlink(File->Name().c_str());
-      _error->Error(curl_errorstr);
+      _error->Error("%s", curl_errorstr);
       Fail();
       return true;
    }