summaryrefslogtreecommitdiff
path: root/apt-pkg/clean.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/clean.cc')
-rw-r--r--apt-pkg/clean.cc11
1 files changed, 7 insertions, 4 deletions
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;
}
/*}}}*/