switch-root: modernize rm_rf_children() invocation a bit
This commit is contained in:
+2
-2
@@ -33,8 +33,8 @@ int rm_rf_children(int fd, RemoveFlags flags, struct stat *root_dev) {
|
||||
|
||||
assert(fd >= 0);
|
||||
|
||||
/* This returns the first error we run into, but nevertheless
|
||||
* tries to go on. This closes the passed fd. */
|
||||
/* This returns the first error we run into, but nevertheless tries to go on. This closes the passed
|
||||
* fd, in all cases, including on failure.. */
|
||||
|
||||
if (!(flags & REMOVE_PHYSICAL)) {
|
||||
|
||||
|
||||
@@ -120,10 +120,8 @@ int switch_root(const char *new_root,
|
||||
|
||||
if (fstat(old_root_fd, &rb) < 0)
|
||||
log_warning_errno(errno, "Failed to stat old root directory, leaving: %m");
|
||||
else {
|
||||
(void) rm_rf_children(old_root_fd, 0, &rb);
|
||||
old_root_fd = -1;
|
||||
}
|
||||
else
|
||||
(void) rm_rf_children(TAKE_FD(old_root_fd), 0, &rb); /* takes possession of the dir fd, even on failure */
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user