From 112cfb181453e38d3ef4a74fba23abbb53392002 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Fri, 31 Jan 2014 15:35:04 -0800 Subject: shared: include root when canonicalizing conf paths The conf_files_list family accepts an alternate root path to prefix all directories in the list but path_strv_canonicalize_uniq doesn't use it. This results in the suspicious behavior of resolving directory symlinks based on the contents of / instead of the alternate root. This adds a prefix argument to path_strv_canonicalize which will now prepend the prefix, if given, to every path in the list. To avoid answering what a relative path means when called with a root prefix path_strv_canonicalize is now path_strv_canonicalize_absolute and only considers absolute paths. Fortunately all users of already call path_strv_canonicalize with a list of absolute paths. --- src/shared/path-lookup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/shared/path-lookup.c') diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c index e2ca9420d9..63af43cdbb 100644 --- a/src/shared/path-lookup.c +++ b/src/shared/path-lookup.c @@ -275,7 +275,7 @@ int lookup_paths_init( } } - if (!path_strv_canonicalize(p->unit_path)) + if (!path_strv_canonicalize_absolute(p->unit_path, NULL)) return -ENOMEM; strv_uniq(p->unit_path); @@ -331,10 +331,10 @@ int lookup_paths_init( return -ENOMEM; } - if (!path_strv_canonicalize(p->sysvinit_path)) + if (!path_strv_canonicalize_absolute(p->sysvinit_path, NULL)) return -ENOMEM; - if (!path_strv_canonicalize(p->sysvrcnd_path)) + if (!path_strv_canonicalize_absolute(p->sysvrcnd_path, NULL)) return -ENOMEM; strv_uniq(p->sysvinit_path); -- cgit v1.2.3-54-g00ecf