summaryrefslogtreecommitdiffstats
path: root/src/analyze/analyze-unit-paths.c
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/analyze/analyze-unit-paths.c
parentshared/install: return failure when enablement fails, but process as much as ... (diff)
downloadsystemd-99aad9a2b9e2c06023a2043976fd9395332ff097.tar.xz
systemd-99aad9a2b9e2c06023a2043976fd9395332ff097.zip
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/analyze/analyze-unit-paths.c')
-rw-r--r--src/analyze/analyze-unit-paths.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/analyze/analyze-unit-paths.c b/src/analyze/analyze-unit-paths.c
index 32c97b2e52..6fa1527dd6 100644
--- a/src/analyze/analyze-unit-paths.c
+++ b/src/analyze/analyze-unit-paths.c
@@ -9,9 +9,9 @@ int verb_unit_paths(int argc, char *argv[], void *userdata) {
_cleanup_(lookup_paths_free) LookupPaths paths = {};
int r;
- r = lookup_paths_init(&paths, arg_scope, 0, NULL);
+ r = lookup_paths_init_or_warn(&paths, arg_scope, 0, NULL);
if (r < 0)
- return log_error_errno(r, "lookup_paths_init() failed: %m");
+ return r;
STRV_FOREACH(p, paths.search_path)
puts(*p);