summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-04-06 20:47:44 +0200
committerLennart Poettering <lennart@poettering.net>2016-04-12 13:43:31 +0200
commit07a7864324e146662cb06f49fc3cd666788e2e2f (patch)
treeb568cd995b905b332616ee7f496403a774f6633d /src/shared
parentd8d410f4455238e30daa1775b469e31f34371f87 (diff)
core: move flushing of generated unit files to path-lookup.c
It's very similar to the mkdir and trim operations for the generator dirs, hence let's unify this at a single place.
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/path-lookup.c11
-rw-r--r--src/shared/path-lookup.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c
index 0735e3b4f5..685ae895d2 100644
--- a/src/shared/path-lookup.c
+++ b/src/shared/path-lookup.c
@@ -726,3 +726,14 @@ void lookup_paths_trim_generator(LookupPaths *p) {
if (p->generator_late)
(void) rmdir(p->generator_late);
}
+
+void lookup_paths_flush_generator(LookupPaths *p) {
+ assert(p);
+
+ if (p->generator)
+ (void) rm_rf(p->generator, REMOVE_ROOT);
+ if (p->generator_early)
+ (void) rm_rf(p->generator_early, REMOVE_ROOT);
+ if (p->generator_late)
+ (void) rm_rf(p->generator_late, REMOVE_ROOT);
+}
diff --git a/src/shared/path-lookup.h b/src/shared/path-lookup.h
index 03f103dcc0..d151347a1b 100644
--- a/src/shared/path-lookup.h
+++ b/src/shared/path-lookup.h
@@ -53,6 +53,7 @@ int lookup_paths_reduce(LookupPaths *p);
int lookup_paths_mkdir_generator(LookupPaths *p);
void lookup_paths_trim_generator(LookupPaths *p);
+void lookup_paths_flush_generator(LookupPaths *p);
void lookup_paths_free(LookupPaths *p);
#define _cleanup_lookup_paths_free_ _cleanup_(lookup_paths_free)