summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2013-02-08 10:22:02 +0100
committerKay Sievers <kay@vrfy.org>2013-02-08 10:23:04 +0100
commit7850b3b83791ba0e2377ba40383c5abc258b839d (patch)
tree2d4630e93d854d4af19c4d0b1f3f6eee32fe0627 /src/shared
parent0b9cc004a4dd20b32459615dd1ab98ba27202095 (diff)
shared: conf-files - add root parameter
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/conf-files.c10
-rw-r--r--src/shared/conf-files.h4
-rw-r--r--src/shared/install.c4
3 files changed, 9 insertions, 9 deletions
diff --git a/src/shared/conf-files.c b/src/shared/conf-files.c
index 34b86293d3..368b7bf6bb 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 f37ee1f3db..4d7941f4cb 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 b82d1891dd..2555a36c0a 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",