]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/tmpfiles/tmpfiles.c
Merge pull request #12750 from keszybz/tmpfiles-c-copy
[thirdparty/systemd.git] / src / tmpfiles / tmpfiles.c
index ef817fca4f7024157003c39b7e17d403ad72573d..02eecf3e3af0e8339a189e7de211cc602769376e 100644 (file)
@@ -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);
         }