chiark / gitweb /
tmpfiles: make sure not to concatenate non-absolute path
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 9 Jan 2015 06:27:31 +0000 (01:27 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 22 Jan 2015 06:14:52 +0000 (01:14 -0500)
If the path is absolute was only checked later.
Also do not check if path if absolute if we just
specified it starting with a slash.

src/tmpfiles/tmpfiles.c

index 8811f274824bfc7165d728cd20f7861ad118cf6c..84d778a08f2c5fee39df69de4eb61c2da67ef963 100644 (file)
@@ -1321,7 +1321,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
 
         case CREATE_SYMLINK:
                 if (!i->argument) {
-                        i->argument = strappend("/usr/share/factory", i->path);
+                        i->argument = strappend("/usr/share/factory/", i->path);
                         if (!i->argument)
                                 return log_oom();
                 }
@@ -1336,12 +1336,10 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
 
         case COPY_FILES:
                 if (!i->argument) {
-                        i->argument = strappend("/usr/share/factory", i->path);
+                        i->argument = strappend("/usr/share/factory/", i->path);
                         if (!i->argument)
                                 return log_oom();
-                }
-
-                if (!path_is_absolute(i->argument)) {
+                } else if (!path_is_absolute(i->argument)) {
                         log_error("[%s:%u] Source path is not absolute.", fname, line);
                         return -EBADMSG;
                 }