Explorar o código

fix -Wall errors

Michael Vogt %!s(int64=13) %!d(string=hai) anos
pai
achega
f52037d629
Modificáronse 5 ficheiros con 10 adicións e 6 borrados
  1. 4 2
      apt-pkg/deb/dpkgpm.cc
  2. 1 1
      apt-pkg/tagfile.h
  3. 1 1
      apt-pkg/vendorlist.cc
  4. 2 1
      cmdline/apt-cdrom.cc
  5. 2 1
      ftparchive/writer.cc

+ 4 - 2
apt-pkg/deb/dpkgpm.cc

@@ -134,7 +134,8 @@ static void dpkgChrootDirectory()
    std::cerr << "Chrooting into " << chrootDir << std::endl;
    if (chroot(chrootDir.c_str()) != 0)
       _exit(100);
-   chdir("/");
+   if (chdir("/") != 0)
+      _exit(100);
 }
 									/*}}}*/
 
@@ -755,7 +756,8 @@ bool pkgDPkgPM::OpenLog()
       pw = getpwnam("root");
       gr = getgrnam("adm");
       if (pw != NULL && gr != NULL)
-	  chown(logfile_name.c_str(), pw->pw_uid, gr->gr_gid);
+         if(chown(logfile_name.c_str(), pw->pw_uid, gr->gr_gid) != 0)
+            _error->Errno("OpenLog", "chown failed");
       chmod(logfile_name.c_str(), 0640);
       fprintf(d->term_out, "\nLog started: %s\n", timestr);
    }

+ 1 - 1
apt-pkg/tagfile.h

@@ -84,7 +84,7 @@ class pkgTagSection
       Stop = this->Stop;
    };
    
-   pkgTagSection() : Section(0), TagCount(0), Stop(0), d(NULL) {};
+   pkgTagSection() : Section(0), TagCount(0), d(NULL), Stop(0) {};
    virtual ~pkgTagSection() {};
 };
 

+ 1 - 1
apt-pkg/vendorlist.cc

@@ -66,7 +66,7 @@ bool pkgVendorList::CreateList(Configuration& Cnf)			/*{{{*/
       Configuration Block(Top);
       string VendorID = Top->Tag;
       vector <struct Vendor::Fingerprint *> *Fingerprints = new vector<Vendor::Fingerprint *>;
-      struct Vendor::Fingerprint *Fingerprint = new struct Vendor::Fingerprint;
+      struct Vendor::Fingerprint *Fingerprint = new struct Vendor::Fingerprint();
       string Origin = Block.Find("Origin");
 
       Fingerprint->Print = Block.Find("Fingerprint");

+ 2 - 1
cmdline/apt-cdrom.cc

@@ -66,7 +66,8 @@ void pkgCdromTextStatus::Prompt(const char *Text)
 {
    char C;
    cout << Text << ' ' << flush;
-   read(STDIN_FILENO,&C,1);
+   if (read(STDIN_FILENO,&C,1) < 0)
+      _error->Errno("pkgCdromTextStatus::Prompt", "failed to prompt");
    if (C != '\n')
       cout << endl;
 }

+ 2 - 1
ftparchive/writer.cc

@@ -284,7 +284,8 @@ bool FTWScanner::Delink(string &FileName,const char *OriginalPath,
 		  if (link(FileName.c_str(),OriginalPath) != 0)
 		  {
 		     // Panic! Restore the symlink
-		     symlink(OldLink,OriginalPath);
+		     if (symlink(OldLink,OriginalPath) != 0)
+                        _error->Errno("symlink", "failed to restore symlink");
 		     return _error->Errno("link",_("*** Failed to link %s to %s"),
 					  FileName.c_str(),
 					  OriginalPath);