diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-04-04 11:52:57 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-04-06 10:57:53 +0200 |
commit | c6878637502b1717a110a9a7e8bba32a8583fcdf (patch) | |
tree | 44bd9f305f8f3b97a0c736c3ac549e568b6495cd /src/core | |
parent | 2f653bded321fc2271edcda43d54fcc3e6c20dc9 (diff) |
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
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/execute.c | 5 | ||||
-rw-r--r-- | src/core/machine-id-setup.c | 2 | ||||
-rw-r--r-- | src/core/manager.c | 3 |
3 files changed, 6 insertions, 4 deletions
diff --git a/src/core/execute.c b/src/core/execute.c index 02df51b5bb..768a32b31f 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -49,6 +49,7 @@ #include <sys/apparmor.h> #endif +#include "rm-rf.h" #include "execute.h" #include "strv.h" #include "macro.h" @@ -2020,7 +2021,7 @@ int exec_context_destroy_runtime_directory(ExecContext *c, const char *runtime_p /* We execute this synchronously, since we need to be * sure this is gone when we start the service * next. */ - rm_rf(p, false, true, false); + (void) rm_rf(p, REMOVE_ROOT); } return 0; @@ -2846,7 +2847,7 @@ int exec_runtime_deserialize_item(ExecRuntime **rt, Unit *u, const char *key, co static void *remove_tmpdir_thread(void *p) { _cleanup_free_ char *path = p; - rm_rf_dangerous(path, false, true, false); + (void) rm_rf(path, REMOVE_ROOT|REMOVE_PHYSICAL); return NULL; } diff --git a/src/core/machine-id-setup.c b/src/core/machine-id-setup.c index 7505dcbcaa..2ffb2a7aa6 100644 --- a/src/core/machine-id-setup.c +++ b/src/core/machine-id-setup.c @@ -313,7 +313,7 @@ int machine_id_commit(const char *root) { if (r < 0) return log_error_errno(r, "We didn't find a valid machine ID in %s.", etc_machine_id); - r = is_fd_on_temporary_fs(fd); + r = fd_is_temporary_fs(fd); if (r < 0) return log_error_errno(r, "Failed to determine whether %s is on a temporary file system: %m", etc_machine_id); if (r == 0) { diff --git a/src/core/manager.c b/src/core/manager.c index 1afd359df2..73417ab1a8 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -52,6 +52,7 @@ #include "locale-setup.h" #include "unit-name.h" #include "missing.h" +#include "rm-rf.h" #include "path-lookup.h" #include "special.h" #include "exit-status.h" @@ -2881,7 +2882,7 @@ static void remove_generator_dir(Manager *m, char **generator) { return; strv_remove(m->lookup_paths.unit_path, *generator); - rm_rf(*generator, false, true, false); + (void) rm_rf(*generator, REMOVE_ROOT); free(*generator); *generator = NULL; |