summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2014-07-08 11:27:01 +0200
committerMichael Vogt <mvo@debian.org>2014-07-08 11:27:01 +0200
commit10ecfe4f8a617ab285abd99d67917ae332ed2e4a (patch)
tree6aeef0fe74b45a5cf419c8b50293400f32b1e1bb /apt-pkg
parent4b73368d8a648247d2695849beba53a2be74151a (diff)
downloadapt-10ecfe4f8a617ab285abd99d67917ae332ed2e4a.tar.gz
Do not clean "/" in pkgAcquire::Clean/pkgArchiveCleaner
Having "/" here is most likely a user configuration error and may cause removal of import symlinks like /vmlinuz Closes: #753531
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/acquire.cc3
-rw-r--r--apt-pkg/clean.cc5
2 files changed, 7 insertions, 1 deletions
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc
index a187a00ae..057bc24cd 100644
--- a/apt-pkg/acquire.cc
+++ b/apt-pkg/acquire.cc
@@ -486,6 +486,9 @@ bool pkgAcquire::Clean(string Dir)
if (DirectoryExists(Dir) == false)
return true;
+ if(Dir == "/")
+ return _error->Error(_("Clean of %s is not supported"), Dir.c_str());
+
DIR *D = opendir(Dir.c_str());
if (D == 0)
return _error->Errno("opendir",_("Unable to read %s"),Dir.c_str());
diff --git a/apt-pkg/clean.cc b/apt-pkg/clean.cc
index 0ee3b765d..37128e9aa 100644
--- a/apt-pkg/clean.cc
+++ b/apt-pkg/clean.cc
@@ -34,7 +34,10 @@
bool pkgArchiveCleaner::Go(std::string Dir,pkgCache &Cache)
{
bool CleanInstalled = _config->FindB("APT::Clean-Installed",true);
-
+
+ if(Dir == "/")
+ return _error->Error(_("Clean of %s is not supported"), Dir.c_str());
+
DIR *D = opendir(Dir.c_str());
if (D == 0)
return _error->Errno("opendir",_("Unable to read %s"),Dir.c_str());