summaryrefslogtreecommitdiff
path: root/apt-pkg/clean.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@ubuntu.com>2012-12-26 23:52:47 +0100
committerMichael Vogt <mvo@ubuntu.com>2012-12-26 23:52:47 +0100
commitd2cca6ec46865a1f5167f846e67150dc19ca2022 (patch)
tree43d335f69870a72b97fa41a1b208784b8753d354 /apt-pkg/clean.cc
parent7735ad0500b6fefef03b2a3dc2a6843e82353e94 (diff)
parentd663a4c8a8723ae4936d10d0a98ea2c05a29cbc4 (diff)
merged from the debian-sid branch
Diffstat (limited to 'apt-pkg/clean.cc')
-rw-r--r--apt-pkg/clean.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/apt-pkg/clean.cc b/apt-pkg/clean.cc
index ed8fa1aa9..eae419e34 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
@@ -79,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();
@@ -115,8 +118,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;
}
/*}}}*/