From a4a518d970e30e47a35ca9f4922d6868500569b6 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Fri, 20 Nov 2026 19:10:01 +0100 Subject: [PATCH] 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 --- src/tmpfiles.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tmpfiles.c b/src/tmpfiles.c index dd1c1247..67ae8df3 100644 --- a/src/tmpfiles.c +++ b/src/tmpfiles.c @@ -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);