diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2015-01-09 01:27:31 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2015-01-22 01:14:52 -0500 |
commit | 222c47f47615a275b9a9862a45f9b91b01eb8be5 (patch) | |
tree | 1d2f71247cbf2a8c6aacdad3468149bd44672dc0 | |
parent | 5f255144ae1ca7162b15e712a79d2eb9d83015f7 (diff) |
tmpfiles: make sure not to concatenate non-absolute path
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.
-rw-r--r-- | src/tmpfiles/tmpfiles.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 8811f27482..84d778a08f 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -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; } |