summaryrefslogtreecommitdiff
path: root/apt-pkg/clean.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2012-03-20 17:05:11 +0100
committerDavid Kalnischkies <kalnischkies@gmail.com>2012-03-20 17:05:11 +0100
commit31bda5000136d77f516cf2080257835fb44deaef (patch)
treeb4c430aee7efcc71382ab73954612f6ff7fe3ef4 /apt-pkg/clean.cc
parent05343a22b8c7d9b491e93169e035a996ff68af9f (diff)
* 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
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;
}
/*}}}*/