diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-04-07 18:48:01 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-04-12 13:43:32 +0200 |
commit | 4943d14306c3e456525fdb793e7f48efea5b9236 (patch) | |
tree | 01ebe6e1d8ff0563f279d45e78c8ddfc0723a164 /src/shared/path-lookup.c | |
parent | a69b4fb0f80689b96f492a557368ed880365edee (diff) |
systemctl: don't confuse sysv code with generated units
The SysV compat code checks whether there's a native unit file before looking
for a SysV init script. Since the newest rework generated units will show up in
the unit path, and hence the checks ended up assuming that there always was a
native unit file for each init script: the generated one.
With this change the generated unit file directory is suppressed from the
search path when this check is done, to avoid the confusion.
Diffstat (limited to 'src/shared/path-lookup.c')
-rw-r--r-- | src/shared/path-lookup.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c index 1c8e22eee7..ca69a0aef2 100644 --- a/src/shared/path-lookup.c +++ b/src/shared/path-lookup.c @@ -441,6 +441,7 @@ static int patch_root_prefix_strv(char **l, const char *root_dir) { int lookup_paths_init( LookupPaths *p, UnitFileScope scope, + LookupPathsFlags flags, const char *root_dir) { _cleanup_free_ char @@ -477,9 +478,11 @@ int lookup_paths_init( if (r < 0 && r != -ENXIO) return r; - r = acquire_generator_dirs(scope, &generator, &generator_early, &generator_late); - if (r < 0 && r != -EOPNOTSUPP && r != -ENXIO) - return r; + if ((flags & LOOKUP_PATHS_EXCLUDE_GENERATED) == 0) { + r = acquire_generator_dirs(scope, &generator, &generator_early, &generator_late); + if (r < 0 && r != -EOPNOTSUPP && r != -ENXIO) + return r; + } r = acquire_transient_dir(scope, &transient); if (r < 0 && r != -EOPNOTSUPP && r != -ENXIO) @@ -751,6 +754,9 @@ int lookup_paths_mkdir_generator(LookupPaths *p) { assert(p); + if (!p->generator || !p->generator_early || !p->generator_late) + return -EINVAL; + r = mkdir_p_label(p->generator, 0755); q = mkdir_p_label(p->generator_early, 0755); @@ -771,10 +777,8 @@ void lookup_paths_trim_generator(LookupPaths *p) { if (p->generator) (void) rmdir(p->generator); - if (p->generator_early) (void) rmdir(p->generator_early); - if (p->generator_late) (void) rmdir(p->generator_late); } |