summaryrefslogtreecommitdiff
path: root/src/core/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/main.c')
-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;
}