diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-03-10 16:47:51 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-03-29 16:17:56 +0200 |
commit | 99aad9a2b9e2c06023a2043976fd9395332ff097 (patch) | |
tree | 83f451c5ecbb365e13bcea180f8f6ec9dc729fbb /src/basic/path-lookup.h | |
parent | 0d11db59825a9deee0b56fdede0602ef1c37c5c5 (diff) | |
download | systemd-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/basic/path-lookup.h')
-rw-r--r-- | src/basic/path-lookup.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/basic/path-lookup.h b/src/basic/path-lookup.h index af85dc7b4f..1f0e5ea271 100644 --- a/src/basic/path-lookup.h +++ b/src/basic/path-lookup.h @@ -54,7 +54,8 @@ struct LookupPaths { char *temporary_dir; }; -int lookup_paths_init(LookupPaths *p, UnitFileScope scope, LookupPathsFlags flags, const char *root_dir); +int lookup_paths_init(LookupPaths *lp, UnitFileScope scope, LookupPathsFlags flags, const char *root_dir); +int lookup_paths_init_or_warn(LookupPaths *lp, UnitFileScope scope, LookupPathsFlags flags, const char *root_dir); int xdg_user_dirs(char ***ret_config_dirs, char ***ret_data_dirs); int xdg_user_runtime_dir(char **ret, const char *suffix); |