From f52037d629aea696f938015e7f1ec037eb079af8 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 8 Aug 2013 15:40:15 +0200 Subject: fix -Wall errors --- apt-pkg/deb/dpkgpm.cc | 6 ++++-- apt-pkg/tagfile.h | 2 +- apt-pkg/vendorlist.cc | 2 +- cmdline/apt-cdrom.cc | 3 ++- ftparchive/writer.cc | 3 ++- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index b0bd6b184..34ae4e593 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/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); } diff --git a/apt-pkg/tagfile.h b/apt-pkg/tagfile.h index 126f4219d..fedd72701 100644 --- a/apt-pkg/tagfile.h +++ b/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() {}; }; diff --git a/apt-pkg/vendorlist.cc b/apt-pkg/vendorlist.cc index ecfc7db87..602425624 100644 --- a/apt-pkg/vendorlist.cc +++ b/apt-pkg/vendorlist.cc @@ -66,7 +66,7 @@ bool pkgVendorList::CreateList(Configuration& Cnf) /*{{{*/ Configuration Block(Top); string VendorID = Top->Tag; vector *Fingerprints = new vector; - 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"); diff --git a/cmdline/apt-cdrom.cc b/cmdline/apt-cdrom.cc index c153cca85..545edf439 100644 --- a/cmdline/apt-cdrom.cc +++ b/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; } diff --git a/ftparchive/writer.cc b/ftparchive/writer.cc index 3283128d8..7ecfe78ed 100644 --- a/ftparchive/writer.cc +++ b/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); -- cgit v1.2.3