Skip to content

Commit c29fb2a

Browse files
DaanDeMeyerbluca
authored andcommitted
tmpfiles: Don't fail if file does not exist in item_do()
If the file was removed by some other program, we should just go to the next one without failing. item_do() is only used for recursive globs instead of fixed paths so skipping on missing files makes sense (unlike if the path was fixed where we should probably fail). Fixes #32691 (hopefully) (cherry picked from commit 677430b) (cherry picked from commit 4641952) (cherry picked from commit 3abc0cb) (cherry picked from commit 56c5942)
1 parent 1b145d9 commit c29fb2a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/tmpfiles/tmpfiles.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2134,7 +2134,7 @@ static int item_do(
21342134
fdaction_t action) {
21352135

21362136
struct stat st;
2137-
int r = 0, q;
2137+
int r = 0, q = 0;
21382138

21392139
assert(i);
21402140
assert(path);
@@ -2168,9 +2168,10 @@ static int item_do(
21682168
continue;
21692169

21702170
de_fd = openat(fd, de->d_name, O_NOFOLLOW|O_CLOEXEC|O_PATH);
2171-
if (de_fd < 0)
2172-
q = log_error_errno(errno, "Failed to open() file '%s': %m", de->d_name);
2173-
else {
2171+
if (de_fd < 0) {
2172+
if (errno != -ENOENT)
2173+
q = log_error_errno(errno, "Failed to open file '%s': %m", de->d_name);
2174+
} else {
21742175
_cleanup_free_ char *de_path = NULL;
21752176

21762177
de_path = path_join(path, de->d_name);

0 commit comments

Comments
 (0)