summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2012-02-18 19:17:57 +0100
committerDavid Kalnischkies <kalnischkies@gmail.com>2012-02-18 19:17:57 +0100
commitc0d58f4276a75f3cd6ebedf20458321a3477a048 (patch)
tree51d78b24a311dcedeba7e08df08137e90004ad3d
parentd90d3a05de6c550ae2bf54347cda7b39074e63ef (diff)
ensure that the cache-directories are really directories before
trying to get a list of included files from them
-rw-r--r--apt-pkg/cachefile.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/apt-pkg/cachefile.cc b/apt-pkg/cachefile.cc
index e425c940d..f852542e5 100644
--- a/apt-pkg/cachefile.cc
+++ b/apt-pkg/cachefile.cc
@@ -182,7 +182,7 @@ void pkgCacheFile::RemoveCaches()
{
std::string cachedir = flNotFile(pkgcache);
std::string cachefile = flNotDir(pkgcache);
- if (cachedir.empty() != true && cachefile.empty() != true)
+ if (cachedir.empty() != true && cachefile.empty() != true && DirectoryExists(cachedir) == true)
{
cachefile.append(".");
std::vector<std::string> caches = GetListOfFilesInDir(cachedir, false);
@@ -201,7 +201,7 @@ void pkgCacheFile::RemoveCaches()
std::string cachedir = flNotFile(srcpkgcache);
std::string cachefile = flNotDir(srcpkgcache);
- if (cachedir.empty() == true || cachefile.empty() == true)
+ if (cachedir.empty() == true || cachefile.empty() == true || DirectoryExists(cachedir) == false)
return;
cachefile.append(".");
std::vector<std::string> caches = GetListOfFilesInDir(cachedir, false);