diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c index 788fd4b1a49..296607d6a27 100644 --- a/src/binfmt/binfmt.c +++ b/src/binfmt/binfmt.c @@ -138,7 +138,7 @@ int main(int argc, char *argv[]) { } else { char **files, **f; - r = conf_files_list(&files, ".conf", + r = conf_files_list(&files, ".conf", NULL, "/etc/binfmt.d", "/run/binfmt.d", "/usr/local/lib/binfmt.d", diff --git a/src/core/load-dropin.c b/src/core/load-dropin.c index 52ebfea6dc7..95c9a386ca8 100644 --- a/src/core/load-dropin.c +++ b/src/core/load-dropin.c @@ -171,7 +171,7 @@ int unit_load_dropin(Unit *u) { _cleanup_strv_free_ char **files = NULL; char **f; - r = conf_files_list_strv(&files, ".conf", (const char**) strv); + r = conf_files_list_strv(&files, ".conf", NULL, (const char**) strv); if (r < 0) { log_error("Failed to get list of configuration files: %s", strerror(-r)); return r; diff --git a/src/journal/catalog.c b/src/journal/catalog.c index 3735ad9213d..32256f6263a 100644 --- a/src/journal/catalog.c +++ b/src/journal/catalog.c @@ -296,7 +296,7 @@ int catalog_update(void) { goto finish; } - r = conf_files_list_strv(&files, ".catalog", (const char **) conf_file_dirs); + r = conf_files_list_strv(&files, ".catalog", NULL, (const char **) conf_file_dirs); if (r < 0) { log_error("Failed to get catalog files: %s", strerror(-r)); goto finish; diff --git a/src/modules-load/modules-load.c b/src/modules-load/modules-load.c index f6279e19752..936aaed8e46 100644 --- a/src/modules-load/modules-load.c +++ b/src/modules-load/modules-load.c @@ -198,7 +198,7 @@ int main(int argc, char *argv[]) { r = EXIT_FAILURE; } - k = conf_files_list(&files, ".conf", + k = conf_files_list(&files, ".conf", NULL, "/etc/modules-load.d", "/run/modules-load.d", "/usr/local/lib/modules-load.d", diff --git a/src/shared/conf-files.c b/src/shared/conf-files.c index 34b86293d3a..368b7bf6bb3 100644 --- a/src/shared/conf-files.c +++ b/src/shared/conf-files.c @@ -37,7 +37,7 @@ #include "hashmap.h" #include "conf-files.h" -static int files_add(Hashmap *h, const char *path, const char *suffix) { +static int files_add(Hashmap *h, const char *root, const char *path, const char *suffix) { DIR *dir; int r = 0; @@ -90,7 +90,7 @@ static int base_cmp(const void *a, const void *b) { return strcmp(path_get_file_name(s1), path_get_file_name(s2)); } -int conf_files_list_strv(char ***strv, const char *suffix, const char **dirs) { +int conf_files_list_strv(char ***strv, const char *suffix, const char *root, const char **dirs) { Hashmap *fh = NULL; char **files = NULL; const char **p; @@ -105,7 +105,7 @@ int conf_files_list_strv(char ***strv, const char *suffix, const char **dirs) { } STRV_FOREACH(p, dirs) { - r = files_add(fh, *p, suffix); + r = files_add(fh, root, *p, suffix); if (r < 0) log_warning("Failed to search for files in %s: %s", *p, strerror(-r)); @@ -126,7 +126,7 @@ finish: return r; } -int conf_files_list(char ***strv, const char *suffix, const char *dir, ...) { +int conf_files_list(char ***strv, const char *suffix, const char *root, const char *dir, ...) { char **dirs = NULL; va_list ap; int r; @@ -145,7 +145,7 @@ int conf_files_list(char ***strv, const char *suffix, const char *dir, ...) { } strv_uniq(dirs); - r = conf_files_list_strv(strv, suffix, (const char **)dirs); + r = conf_files_list_strv(strv, suffix, root, (const char **)dirs); finish: strv_free(dirs); diff --git a/src/shared/conf-files.h b/src/shared/conf-files.h index f37ee1f3dbf..4d7941f4cb5 100644 --- a/src/shared/conf-files.h +++ b/src/shared/conf-files.h @@ -25,7 +25,7 @@ #include "macro.h" -int conf_files_list(char ***strv, const char *suffix, const char *dir, ...); -int conf_files_list_strv(char ***strv, const char *suffix, const char **dirs); +int conf_files_list(char ***strv, const char *suffix, const char *root, const char *dir, ...); +int conf_files_list_strv(char ***strv, const char *suffix, const char *root, const char **dirs); #endif diff --git a/src/shared/install.c b/src/shared/install.c index b82d1891dd3..2555a36c0a9 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -1658,7 +1658,7 @@ int unit_file_query_preset(UnitFileScope scope, const char *name) { assert(name); if (scope == UNIT_FILE_SYSTEM) - r = conf_files_list(&files, ".preset", + r = conf_files_list(&files, ".preset", NULL, "/etc/systemd/system-preset", "/usr/local/lib/systemd/system-preset", "/usr/lib/systemd/system-preset", @@ -1667,7 +1667,7 @@ int unit_file_query_preset(UnitFileScope scope, const char *name) { #endif NULL); else if (scope == UNIT_FILE_GLOBAL) - r = conf_files_list(&files, ".preset", + r = conf_files_list(&files, ".preset", NULL, "/etc/systemd/user-preset", "/usr/local/lib/systemd/user-preset", "/usr/lib/systemd/user-preset", diff --git a/src/sysctl/sysctl.c b/src/sysctl/sysctl.c index 035e0ec321c..f5ef89b3857 100644 --- a/src/sysctl/sysctl.c +++ b/src/sysctl/sysctl.c @@ -289,7 +289,7 @@ int main(int argc, char *argv[]) { } else { char **files, **f; - r = conf_files_list(&files, ".conf", + r = conf_files_list(&files, ".conf", NULL, "/etc/sysctl.d", "/run/sysctl.d", "/usr/local/lib/sysctl.d", diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c index f5430e9f78a..b8c6b368585 100644 --- a/src/timedate/timedated.c +++ b/src/timedate/timedated.c @@ -280,7 +280,7 @@ static char** get_ntp_services(void) { char **r = NULL, **files, **i; int k; - k = conf_files_list(&files, ".list", + k = conf_files_list(&files, ".list", NULL, "/etc/systemd/ntp-units.d", "/run/systemd/ntp-units.d", "/usr/local/lib/systemd/ntp-units.d", diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index c2023f5454c..96adbff42e9 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -1435,7 +1435,7 @@ int main(int argc, char *argv[]) { } else { char **files, **f; - r = conf_files_list_strv(&files, ".conf", (const char **)conf_file_dirs); + r = conf_files_list_strv(&files, ".conf", NULL, (const char **)conf_file_dirs); if (r < 0) { log_error("Failed to enumerate tmpfiles.d files: %s", strerror(-r)); r = EXIT_FAILURE; diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index bb57d2af480..a86f8c365a9 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -1619,7 +1619,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) return udev_rules_unref(rules); udev_rules_check_timestamp(rules); - r = conf_files_list_strv(&files, ".rules", (const char **)rules->dirs); + r = conf_files_list_strv(&files, ".rules", NULL, (const char **)rules->dirs); if (r < 0) { log_error("failed to enumerate rules files: %s\n", strerror(-r)); return udev_rules_unref(rules); diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c index 8e515b9f715..596a89b6400 100644 --- a/src/udev/udevadm-hwdb.c +++ b/src/udev/udevadm-hwdb.c @@ -537,7 +537,7 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) { } trie->nodes_count++; - err = conf_files_list_strv(&files, ".hwdb", (const char **)conf_file_dirs); + err = conf_files_list_strv(&files, ".hwdb", NULL, (const char **)conf_file_dirs); if (err < 0) { log_error("failed to enumerate hwdb files: %s\n", strerror(-err)); rc = EXIT_FAILURE;