util: add generic calls for prefixing a root directory to a path

So far a number of utilities implemented their own calls for this, unify
them in prefix_root() and prefix_roota(). The former uses heap memory,
the latter allocates from the stack via alloca().

Port over most users of a --root= logic.
This commit is contained in:
Lennart Poettering
2015-05-13 17:42:10 +02:00
parent 8b44a3d22c
commit 1d13f648d0
7 changed files with 109 additions and 23 deletions
+1 -1
View File
@@ -1926,7 +1926,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
if (arg_root) {
char *p;
p = strappend(arg_root, i.path);
p = prefix_root(arg_root, i.path);
if (!p)
return log_oom();