[systemd-devel] [PATCH 5/5] shared: fix search_and_fopen with alternate roots

Michael Marineau michael.marineau at coreos.com
Thu Jun 19 19:07:06 PDT 2014


Update for the current behavior of path_strv_resolve which now returns
paths relative to the given root, not the full absolute paths.
---
 src/shared/util.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/shared/util.c b/src/shared/util.c
index c1e1f9f..aaf109e 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -5686,7 +5686,10 @@ static int search_and_fopen_internal(const char *path, const char *mode, const c
                 _cleanup_free_ char *p = NULL;
                 FILE *f;
 
-                p = strjoin(*i, "/", path, NULL);
+                if (root)
+                        p = strjoin(root, *i, "/", path, NULL);
+                else
+                        p = strjoin(*i, "/", path, NULL);
                 if (!p)
                         return -ENOMEM;
 
-- 
1.8.5.5



More information about the systemd-devel mailing list