util: rework rm_rf() logic

- Move to its own file rm-rf.c

- Change parameters into a single flags parameter

- Remove "honour sticky" logic, it's unused these days
This commit is contained in:
Lennart Poettering
2015-04-06 10:57:53 +02:00
parent 2f653bded3
commit c687863750
34 changed files with 294 additions and 255 deletions
+3 -2
View File
@@ -29,10 +29,11 @@
#include "util.h"
#include "path-util.h"
#include "switch-root.h"
#include "mkdir.h"
#include "rm-rf.h"
#include "base-filesystem.h"
#include "missing.h"
#include "switch-root.h"
int switch_root(const char *new_root, const char *oldroot, bool detach_oldroot, unsigned long mountflags) {
@@ -142,7 +143,7 @@ int switch_root(const char *new_root, const char *oldroot, bool detach_oldroot,
if (fstat(old_root_fd, &rb) < 0)
log_warning_errno(errno, "Failed to stat old root directory, leaving: %m");
else {
rm_rf_children(old_root_fd, false, false, &rb);
(void) rm_rf_children(old_root_fd, 0, &rb);
old_root_fd = -1;
}
}