summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarald Hoyer <harald@redhat.com>2012-05-16 15:08:28 +0200
committerLennart Poettering <lennart@poettering.net>2012-05-21 18:53:02 +0200
commit97a66e94700845239cfe628da3569ac06034fa4d (patch)
tree107f4e5b21d14f817325c9ab57f643a663bad8d4
parent597f43c7849dc9fc9aeb806f8d4f9679cabce8e6 (diff)
main: do_switch_root() do not recursively remove across device boundaries
-rw-r--r--src/core/main.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/core/main.c b/src/core/main.c
index 878eaf353f..4d09cb7174 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1234,7 +1234,14 @@ static int do_switch_root(const char *switch_root) {
}
if (cfd >= 0) {
- rm_rf_children(cfd, false, false);
+ struct stat rb;
+
+ if (fstat(cfd, &rb)) {
+ log_error("failed to stat old root directory");
+ goto fail;
+ }
+
+ rm_rf_children(cfd, false, false, &rb);
close(cfd);
cfd=-1;
}