diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-02-08 13:57:05 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-02-09 12:27:34 +0100 |
commit | 7b6344d35fdbe523fb6eff2fdfa892d7f07ebfa9 (patch) | |
tree | 3639ba8223f93b54e3fe12e1c57c1172e9271b0c /src/shared/path-lookup.c | |
parent | c59479e7908474a461a5eeb905fc852fd0add673 (diff) | |
download | systemd-7b6344d35fdbe523fb6eff2fdfa892d7f07ebfa9.tar.gz |
path-lookup: include paths from --global in --user search path too
This doesn't matter that much, because set-property --global does not work,
so at least those paths wouldn't be used automatically. It is still possible
to create such snippets manually, so we better fix this.
Diffstat (limited to 'src/shared/path-lookup.c')
-rw-r--r-- | src/shared/path-lookup.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c index 91b2aa8638..3c57aa6732 100644 --- a/src/shared/path-lookup.c +++ b/src/shared/path-lookup.c @@ -169,6 +169,8 @@ int xdg_user_dirs(char ***ret_config_dirs, char ***ret_data_dirs) { static char** user_dirs( const char *persistent_config, const char *runtime_config, + const char *global_persistent_config, + const char *global_runtime_config, const char *generator, const char *generator_early, const char *generator_late, @@ -209,12 +211,19 @@ static char** user_dirs( if (strv_extend(&res, persistent_config) < 0) return NULL; + /* global config has lower priority than the user config of the same type */ + if (strv_extend(&res, global_persistent_config) < 0) + return NULL; + if (strv_extend_strv(&res, (char**) user_config_unit_paths, false) < 0) return NULL; if (strv_extend(&res, runtime_config) < 0) return NULL; + if (strv_extend(&res, global_runtime_config) < 0) + return NULL; + if (strv_extend(&res, generator) < 0) return NULL; @@ -484,6 +493,7 @@ int lookup_paths_init( _cleanup_free_ char *root = NULL, *persistent_config = NULL, *runtime_config = NULL, + *global_persistent_config = NULL, *global_runtime_config = NULL, *generator = NULL, *generator_early = NULL, *generator_late = NULL, *transient = NULL, *persistent_control = NULL, *runtime_control = NULL; @@ -522,6 +532,12 @@ int lookup_paths_init( if (r < 0) return r; + if (scope == UNIT_FILE_USER) { + r = acquire_config_dirs(UNIT_FILE_GLOBAL, &global_persistent_config, &global_runtime_config); + if (r < 0) + return r; + } + if ((flags & LOOKUP_PATHS_EXCLUDE_GENERATED) == 0) { /* Note: if XDG_RUNTIME_DIR is not set, this will fail completely with ENXIO */ r = acquire_generator_dirs(scope, tempdir, @@ -621,6 +637,7 @@ int lookup_paths_init( case UNIT_FILE_USER: add = user_dirs(persistent_config, runtime_config, + global_persistent_config, global_runtime_config, generator, generator_early, generator_late, transient, persistent_control, runtime_control); |