summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2011-01-16 07:21:17 +0100
committerGuillem Jover <guillem@debian.org>2011-01-16 10:22:40 +0100
commit626560b31133376bfb5593770b2ee1fc83931c29 (patch)
treebd19b1d3c19339989ad64b9bd7bf28958b82e2b0 /src
parente63e1fa4a4afdf98847f13f2506a0aeea68c33c7 (diff)
downloaddpkg-626560b31133376bfb5593770b2ee1fc83931c29.tar.gz
dpkg: Do not fail when trying to remove the root directory
This will happen when removing the last package from an installation, which does never happen on normal conditions on Debian-based systems. But it can happen either on other distributions where dpkg is a foreign package manager, or on test databases.
Diffstat (limited to 'src')
-rw-r--r--src/remove.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/remove.c b/src/remove.c
index 2699561cc..b002fc32e 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -259,6 +259,11 @@ static void removal_bulk_remove_files(
pkg->name, namenode->name, strerror(errno));
push_leftover(&leftover,namenode);
continue;
+ } else if (errno == EINVAL && strcmp(usenode->name, "/.") == 0) {
+ debug(dbg_eachfiledetail, "removal_bulk '%s' root directory, cannot remove",
+ fnvb.buf);
+ push_leftover(&leftover, namenode);
+ continue;
}
if (errno != ENOTDIR) ohshite(_("cannot remove `%.250s'"),fnvb.buf);
debug(dbg_eachfiledetail, "removal_bulk unlinking `%s'", fnvb.buf);
@@ -368,6 +373,11 @@ static void removal_bulk_remove_leftover_dirs(struct pkginfo *pkg) {
pkg->name, namenode->name, strerror(errno));
push_leftover(&leftover,namenode);
continue;
+ } else if (errno == EINVAL && strcmp(usenode->name, "/.") == 0) {
+ debug(dbg_eachfiledetail, "removal_bulk '%s' root directory, cannot remove",
+ fnvb.buf);
+ push_leftover(&leftover, namenode);
+ continue;
}
if (errno != ENOTDIR) ohshite(_("cannot remove `%.250s'"),fnvb.buf);