tmpfiles: stop at a backslash that ends the argument

write_arg() takes the character after a backslash as an escape.  With
the backslash last in the argument that character is the end of the
string, and the loop went on reading past it.

fparseln() takes a backslash at the end of a line as a continuation,
so an argument does not end in one today.  Write the backslash as it
is and stop, should that change.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-11-20 19:10:04 +01:00
1 parent 81ce7a2833
commit a4a518d970
1 file changed
+4
+4
View File
@@ -254,6 +254,10 @@ static void write_arg(FILE *fp, char *arg)
fwrite(arg, sizeof(char), p - arg, fp);
p++;
if (!*p) { /* A backslash that ends the argument */
arg = p - 1;
break;
}
switch (*p) {
case '\\':
fputc('\\', fp);