From 31bda5000136d77f516cf2080257835fb44deaef Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 20 Mar 2012 17:05:11 +0100 Subject: * apt-pkg/acquire-worker.cc: - check return of write() as gcc recommends * apt-pkg/acquire.cc: - check return of write() as gcc recommends * apt-pkg/cdrom.cc: - check return of chdir() and link() as gcc recommends * apt-pkg/clean.cc: - check return of chdir() as gcc recommends * apt-pkg/contrib/netrc.cc: - check return of asprintf() as gcc recommends --- apt-pkg/clean.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'apt-pkg/clean.cc') diff --git a/apt-pkg/clean.cc b/apt-pkg/clean.cc index ed8fa1aa9..9c167eaa5 100644 --- a/apt-pkg/clean.cc +++ b/apt-pkg/clean.cc @@ -54,9 +54,11 @@ bool pkgArchiveCleaner::Go(std::string Dir,pkgCache &Cache) struct stat St; if (stat(Dir->d_name,&St) != 0) { - chdir(StartDir.c_str()); + _error->Errno("stat",_("Unable to stat %s."),Dir->d_name); closedir(D); - return _error->Errno("stat",_("Unable to stat %s."),Dir->d_name); + if (chdir(StartDir.c_str()) != 0) + return _error->Errno("chdir", _("Unable to change to %s"), StartDir.c_str()); + return false; } // Grab the package name @@ -115,8 +117,9 @@ bool pkgArchiveCleaner::Go(std::string Dir,pkgCache &Cache) Erase(Dir->d_name,Pkg,Ver,St); }; - chdir(StartDir.c_str()); closedir(D); - return true; + if (chdir(StartDir.c_str()) != 0) + return _error->Errno("chdir", _("Unable to change to %s"), StartDir.c_str()); + return true; } /*}}}*/ -- cgit v1.2.3 From 469b02781dfb4517282da4d497c5f7fd0dcb97f4 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 5 Jul 2012 08:59:52 +0200 Subject: * apt-pkg/clean.cc: - run autoclean against pkg:arch and not always against pkg:native as this removes valid cache entries (Closes: #679371) --- apt-pkg/clean.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'apt-pkg/clean.cc') diff --git a/apt-pkg/clean.cc b/apt-pkg/clean.cc index 9c167eaa5..eae419e34 100644 --- a/apt-pkg/clean.cc +++ b/apt-pkg/clean.cc @@ -81,12 +81,13 @@ bool pkgArchiveCleaner::Go(std::string Dir,pkgCache &Cache) if (*I != '.') continue; std::string const Arch = DeQuoteString(std::string(Start,I-Start)); - + + // ignore packages of unconfigured architectures if (APT::Configuration::checkArchitecture(Arch) == false) continue; // Lookup the package - pkgCache::PkgIterator P = Cache.FindPkg(Pkg); + pkgCache::PkgIterator P = Cache.FindPkg(Pkg, Arch); if (P.end() != true) { pkgCache::VerIterator V = P.VersionList(); -- cgit v1.2.3