diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-02-03 12:52:16 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-02-03 19:59:18 +0100 |
commit | fdb9161cd3e1a64eb9a653a6bf69596670d6e942 (patch) | |
tree | 1e3bf14a87ebea497cf9829d3070e02f27308749 /src/core | |
parent | e59749b1f8a960060b7b8e850cc79f97ddaf2db4 (diff) |
conf-parser: warn when we open configuration files with weird access bits
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/load-dropin.c | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/src/core/load-dropin.c b/src/core/load-dropin.c index 35040090ac..546e560b85 100644 --- a/src/core/load-dropin.c +++ b/src/core/load-dropin.c @@ -100,8 +100,8 @@ static int process_dir( UnitDependency dependency, char ***strv) { + _cleanup_free_ char *path = NULL; int r; - char *path; assert(u); assert(unit_path); @@ -112,39 +112,29 @@ static int process_dir( if (!path) return log_oom(); - if (u->manager->unit_path_cache && - !set_get(u->manager->unit_path_cache, path)) - r = 0; - else + if (!u->manager->unit_path_cache || set_get(u->manager->unit_path_cache, path)) { r = iterate_dir(u, path, dependency, strv); - free(path); - - if (r < 0) - return r; + if (r < 0) + return r; + } if (u->instance) { - char *template; + _cleanup_free_ char *template = NULL, *p = NULL; /* Also try the template dir */ template = unit_name_template(name); if (!template) return log_oom(); - path = strjoin(unit_path, "/", template, suffix, NULL); - free(template); - - if (!path) + p = strjoin(unit_path, "/", template, suffix, NULL); + if (!p) return log_oom(); - if (u->manager->unit_path_cache && - !set_get(u->manager->unit_path_cache, path)) - r = 0; - else - r = iterate_dir(u, path, dependency, strv); - free(path); - - if (r < 0) - return r; + if (!u->manager->unit_path_cache || set_get(u->manager->unit_path_cache, p)) { + r = iterate_dir(u, p, dependency, strv); + if (r < 0) + return r; + } } return 0; |