summaryrefslogtreecommitdiff
path: root/src/shared/install.c
diff options
context:
space:
mode:
authorMichael Marineau <michael.marineau@coreos.com>2014-06-19 19:07:04 -0700
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-06-20 00:10:47 -0400
commitcba2ef02722114da2b730d57f1e3bb43013d8921 (patch)
treeac9c2f54223fc47fc5a3739a0c2adeb9e4110c51 /src/shared/install.c
parent3e8a78c8dceedb001587cb6c1eaa31cb8aa56729 (diff)
conf-files: include root in returned file paths
This restores the original root handling logic that was present prior to 112cfb18 when path expansion moved to path_strv_canonicalize_absolute. That behavior partially went away in 12ed81d9. Alternatively all users of conf_files_list* could be updated to concatenate the paths themselves as unit_file_query_preset did but since no user needs the un-concatenated form that is pointless duplication.
Diffstat (limited to 'src/shared/install.c')
-rw-r--r--src/shared/install.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/shared/install.c b/src/shared/install.c
index 4f7179309e..190c554347 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -1776,7 +1776,7 @@ UnitFileState unit_file_get_state(
int unit_file_query_preset(UnitFileScope scope, const char *root_dir, const char *name) {
_cleanup_strv_free_ char **files = NULL;
- char **i;
+ char **p;
int r;
assert(scope >= 0);
@@ -1804,17 +1804,10 @@ int unit_file_query_preset(UnitFileScope scope, const char *root_dir, const char
if (r < 0)
return r;
- STRV_FOREACH(i, files) {
- _cleanup_free_ char *buf = NULL;
+ STRV_FOREACH(p, files) {
_cleanup_fclose_ FILE *f;
- const char *p;
-
- if (root_dir)
- p = buf = strjoin(root_dir, "/", *i, NULL);
- else
- p = *i;
- f = fopen(p, "re");
+ f = fopen(*p, "re");
if (!f) {
if (errno == ENOENT)
continue;