From 07a7864324e146662cb06f49fc3cd666788e2e2f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 6 Apr 2016 20:47:44 +0200 Subject: 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. --- src/shared/path-lookup.c | 11 +++++++++++ src/shared/path-lookup.h | 1 + 2 files changed, 12 insertions(+) (limited to 'src/shared') 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) -- cgit v1.2.3-54-g00ecf