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/test/test-path.c | |
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/test/test-path.c')
-rw-r--r-- | src/test/test-path.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/test/test-path.c b/src/test/test-path.c index a3295aa997..219b585b7c 100644 --- a/src/test/test-path.c +++ b/src/test/test-path.c @@ -26,6 +26,7 @@ #include "macro.h" #include "strv.h" #include "mkdir.h" +#include "rm-rf.h" typedef void (*test_function_t)(Manager *m); @@ -47,7 +48,12 @@ static int setup_test(Manager **m) { assert_se(manager_startup(tmp, NULL, NULL) >= 0); STRV_FOREACH(test_path, tests_path) { - rm_rf_dangerous(strjoina("/tmp/test-path_", *test_path), false, true, false); + _cleanup_free_ char *p = NULL; + + p = strjoin("/tmp/test-path_", *test_path, NULL); + assert_se(p); + + (void) rm_rf(p, REMOVE_ROOT|REMOVE_PHYSICAL); } *m = tmp; @@ -104,7 +110,7 @@ static void check_stop_unlink(Manager *m, Unit *unit, const char *test_path, con } assert_se(UNIT_VTABLE(unit)->stop(unit) >= 0); - rm_rf_dangerous(test_path, false, true, false); + (void) rm_rf(test_path, REMOVE_ROOT|REMOVE_PHYSICAL); } static void test_path_exists(Manager *m) { @@ -228,7 +234,7 @@ static void test_path_makedirectory_directorymode(Manager *m) { assert_se((s.st_mode & S_IRWXO) == 0004); assert_se(UNIT_VTABLE(unit)->stop(unit) >= 0); - rm_rf_dangerous(test_path, false, true, false); + (void) rm_rf(test_path, REMOVE_ROOT|REMOVE_PHYSICAL); } int main(int argc, char *argv[]) { |