summaryrefslogtreecommitdiff
path: root/src/tmpfiles
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2019-07-11 18:13:19 +0200
committerGitHub <noreply@github.com>2019-07-11 18:13:19 +0200
commit6c75f78e94c919d76e4f6e3d65abedba0e13e43f (patch)
tree78373fd2ad532af9ae13cba9be401861fed477e6 /src/tmpfiles
parent7a555216df6e22c0d7b2b2d855b79e3e292f8c32 (diff)
parentb0458daf947aa4cd3965dc2eeda95cd745fdd0b4 (diff)
downloadsystemd-6c75f78e94c919d76e4f6e3d65abedba0e13e43f.tar.gz
systemd-6c75f78e94c919d76e4f6e3d65abedba0e13e43f.tar.bz2
systemd-6c75f78e94c919d76e4f6e3d65abedba0e13e43f.zip
Merge pull request #12750 from keszybz/tmpfiles-c-copy
Make tmpfiles C use --root
Diffstat (limited to 'src/tmpfiles')
-rw-r--r--src/tmpfiles/tmpfiles.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index ef817fca4f..02eecf3e3a 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -2613,13 +2613,22 @@ static int parse_line(const char *fname, unsigned line, const char *buffer, bool
case COPY_FILES:
if (!i.argument) {
- i.argument = strappend("/usr/share/factory/", i.path);
+ i.argument = path_join(arg_root, "/usr/share/factory/", i.path);
if (!i.argument)
return log_oom();
+
} else if (!path_is_absolute(i.argument)) {
*invalid_config = true;
log_error("[%s:%u] Source path is not absolute.", fname, line);
return -EBADMSG;
+
+ } else if (arg_root) {
+ char *p;
+
+ p = prefix_root(arg_root, i.argument);
+ if (!p)
+ return log_oom();
+ free_and_replace(i.argument, p);
}
path_simplify(i.argument, false);
@@ -2713,7 +2722,6 @@ static int parse_line(const char *fname, unsigned line, const char *buffer, bool
p = path_join(arg_root, i.path);
if (!p)
return log_oom();
-
free_and_replace(i.path, p);
}