main: do_switch_root() do not recursively remove across device boundaries

This commit is contained in:
Harald Hoyer
2012-05-21 18:53:02 +02:00
committed by Lennart Poettering
parent 597f43c784
commit 97a66e9470
+8 -1
View File
@@ -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;
}