summaryrefslogtreecommitdiff
path: root/src/sysv-generator
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-03-10 16:47:51 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-03-29 16:17:56 +0200
commit99aad9a2b9e2c06023a2043976fd9395332ff097 (patch)
tree83f451c5ecbb365e13bcea180f8f6ec9dc729fbb /src/sysv-generator
parent0d11db59825a9deee0b56fdede0602ef1c37c5c5 (diff)
downloadsystemd-99aad9a2b9e2c06023a2043976fd9395332ff097.tar.gz
systemctl: fix silent failure when --root is not found
Some calls to lookup_path_init() were not followed by any log emission. E.g.: $ SYSTEMD_LOG_LEVEL=debug systemctl --root=/missing enable unit; echo $? 1 Let's add a helper function and use it in various places. $ SYSTEMD_LOG_LEVEL=debug build/systemctl --root=/missing enable unit; echo $? Failed to initialize unit search paths for root directory /missing: No such file or directory 1 $ SYSTEMCTL_SKIP_SYSV=1 build/systemctl --root=/missing enable unit; echo $? Failed to initialize unit search paths for root directory /missing: No such file or directory Failed to enable: No such file or directory. 1 The repeated error in the second case is not very nice, but this is a niche case and I don't think it's worth the trouble to trying to avoid it.
Diffstat (limited to 'src/sysv-generator')
-rw-r--r--src/sysv-generator/sysv-generator.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
index a81df6600b..428509f4ce 100644
--- a/src/sysv-generator/sysv-generator.c
+++ b/src/sysv-generator/sysv-generator.c
@@ -891,9 +891,9 @@ static int run(const char *dest, const char *dest_early, const char *dest_late)
assert_se(arg_dest = dest_late);
- r = lookup_paths_init(&lp, UNIT_FILE_SYSTEM, LOOKUP_PATHS_EXCLUDE_GENERATED, NULL);
+ r = lookup_paths_init_or_warn(&lp, UNIT_FILE_SYSTEM, LOOKUP_PATHS_EXCLUDE_GENERATED, NULL);
if (r < 0)
- return log_error_errno(r, "Failed to find lookup paths: %m");
+ return r;
all_services = hashmap_new(&string_hash_ops);
if (!all_services)