systemd-path: allow the default search path to be queried

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2018-04-16 16:09:46 +02:00
parent 42345b178d
commit e12d446b66
5 changed files with 21 additions and 5 deletions
+13 -1
View File
@@ -348,6 +348,7 @@ _public_ int sd_path_home(uint64_t type, const char *suffix, char **path) {
if (IN_SET(type,
SD_PATH_SEARCH_BINARIES,
SD_PATH_SEARCH_BINARIES_DEFAULT,
SD_PATH_SEARCH_LIBRARY_PRIVATE,
SD_PATH_SEARCH_LIBRARY_ARCH,
SD_PATH_SEARCH_SHARED,
@@ -566,7 +567,17 @@ static int get_search(uint64_t type, char ***list) {
false,
"/etc",
NULL);
}
case SD_PATH_SEARCH_BINARIES_DEFAULT: {
char **t;
t = strv_split_nulstr(DEFAULT_PATH_NULSTR);
if (!t)
return -ENOMEM;
*list = t;
return 0;
}}
return -EOPNOTSUPP;
}
@@ -579,6 +590,7 @@ _public_ int sd_path_search(uint64_t type, const char *suffix, char ***paths) {
if (!IN_SET(type,
SD_PATH_SEARCH_BINARIES,
SD_PATH_SEARCH_BINARIES_DEFAULT,
SD_PATH_SEARCH_LIBRARY_PRIVATE,
SD_PATH_SEARCH_LIBRARY_ARCH,
SD_PATH_SEARCH_SHARED,