diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 07432a1e51..4bbf9b4ace 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -3153,6 +3153,13 @@ static int parse_line( } path_simplify(i.argument); + + if (laccess(i.argument, F_OK) == -ENOENT) { + /* Silently skip over lines where the source file is missing. */ + log_syntax(NULL, LOG_INFO, fname, line, 0, "Copy source path '%s' does not exist, skipping line.", i.argument); + return 0; + } + break; case CREATE_CHAR_DEVICE: diff --git a/test/units/testsuite-22.02.sh b/test/units/testsuite-22.02.sh index 0719d68292..49c55f136b 100755 --- a/test/units/testsuite-22.02.sh +++ b/test/units/testsuite-22.02.sh @@ -116,6 +116,8 @@ test "$(stat -c %U:%G:%a /tmp/C/2/f1)" = "daemon:daemon:755" systemd-tmpfiles --create - <