summaryrefslogtreecommitdiff
path: root/src/tmpfiles
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@strace.io>2022-01-29 20:00:00 +0000
committerDmitry V. Levin <ldv@strace.io>2022-01-29 20:00:00 +0000
commit05381430a5d632ffc716fb4c89328952bd8ccafd (patch)
treee26bf8373c7877a05f982cee1ccd2f988ae3c645 /src/tmpfiles
parent1ed8887e3b539c89f3bb381427fbe9b0307bdfd0 (diff)
downloadsystemd-05381430a5d632ffc716fb4c89328952bd8ccafd.tar.gz
tmpfiles: avoid double specifier expansion in L lines
Starting with commit 2f3b873a4973, when the path contains a specifier and the argument is omitted, tmpfiles used to perform specifier expansions twice: first specifier expansion was applied to the path itself, and afterwards the result of the first expansion was used in the constructed argument and expanded once again. Resolves: #26244 Fixes: 2f3b873a4973 ("tmpfiles: copy/link /usr/share/factory/ files when the source argument is omitted")
Diffstat (limited to 'src/tmpfiles')
-rw-r--r--src/tmpfiles/tmpfiles.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index 54db55ff1f..458aed7054 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -3314,12 +3314,6 @@ static int parse_line(
*invalid_config = true;
return log_syntax(NULL, LOG_ERR, fname, line, SYNTHETIC_ERRNO(EBADMSG), "base64 decoding not supported for symlink targets.");
}
-
- if (!i.argument) {
- i.argument = path_join("/usr/share/factory", i.path);
- if (!i.argument)
- return log_oom();
- }
break;
case WRITE_FILE:
@@ -3428,6 +3422,14 @@ static int parse_line(
}
switch (i.type) {
+ case CREATE_SYMLINK:
+ if (!i.argument) {
+ i.argument = path_join("/usr/share/factory", i.path);
+ if (!i.argument)
+ return log_oom();
+ }
+ break;
+
case COPY_FILES:
if (!i.argument) {
i.argument = path_join("/usr/share/factory", i.path);