diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-02-04 20:50:44 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-02-07 21:31:22 -0500 |
commit | 957787821008f5823804c928c9cdc77bb3910027 (patch) | |
tree | c46828e6d7fd4a9a36522bfcc3a76d0d012d2ea7 /src/shared/dropin.c | |
parent | 5dd11ab5f36ce71138005941ea69458e169b3af6 (diff) | |
download | systemd-957787821008f5823804c928c9cdc77bb3910027.tar.gz |
core: when loading .wants and .requires, follow the same logic as .d conf dropins
Essentially, instead of sequentially adding deps based on all symlinks
encountered in .wants and .requires dirs for each name and each unit file load
path, iteratate over the load paths and unit names gathering symlinks, then
order them based on priority, and then iterate over the final list, adding
dependencies.
This patch doesn't change the logic too much, except that the order in which
dependencies are applied might be different. It wasn't defined before, so that
not really a change. Adding filtering on the symlinks is left for later
patches.
Diffstat (limited to 'src/shared/dropin.c')
-rw-r--r-- | src/shared/dropin.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/shared/dropin.c b/src/shared/dropin.c index 06cf3de620..3944ccec44 100644 --- a/src/shared/dropin.c +++ b/src/shared/dropin.c @@ -173,7 +173,7 @@ static int iterate_dir( return 0; } -int unit_file_process_dir( +static int unit_file_process_dir( const char *original_root, Set *unit_path_cache, const char *unit_path, @@ -221,6 +221,8 @@ int unit_file_find_dropin_paths( const char *original_root, char **lookup_path, Set *unit_path_cache, + const char *dir_suffix, + const char *file_suffix, Set *names, char ***paths) { @@ -235,16 +237,17 @@ int unit_file_find_dropin_paths( char **p; STRV_FOREACH(p, lookup_path) - unit_file_process_dir(original_root, unit_path_cache, *p, t, ".d", + unit_file_process_dir(original_root, unit_path_cache, + *p, t, dir_suffix, _UNIT_DEPENDENCY_INVALID, NULL, NULL, &strv); } if (strv_isempty(strv)) return 0; - r = conf_files_list_strv(&ans, ".conf", NULL, (const char**) strv); + r = conf_files_list_strv(&ans, file_suffix, NULL, (const char**) strv); if (r < 0) - return log_warning_errno(r, "Failed to get list of configuration files: %m"); + return log_warning_errno(r, "Failed to sort the list of configuration files: %m"); *paths = ans; ans = NULL; |