diff options
-rw-r--r-- | src/core/switch-root.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/core/switch-root.c b/src/core/switch-root.c index ed0a31e697..9832a520e4 100644 --- a/src/core/switch-root.c +++ b/src/core/switch-root.c @@ -111,8 +111,10 @@ int switch_root(const char *new_root) { if (fstat(old_root_fd, &rb) < 0) log_warning("Failed to stat old root directory, leaving: %m"); - else + else { rm_rf_children(old_root_fd, false, false, &rb); + old_root_fd = -1; + } } r = 0; |