Skip to content

Commit 4641952

Browse files
DaanDeMeyerkeszybz
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)
1 parent 4feea04 commit 4641952

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
@@ -2366,7 +2366,7 @@ static int item_do(
23662366
fdaction_t action) {
23672367

23682368
struct stat st;
2369-
int r = 0, q;
2369+
int r = 0, q = 0;
23702370

23712371
assert(c);
23722372
assert(i);
@@ -2401,9 +2401,10 @@ static int item_do(
24012401
continue;
24022402

24032403
de_fd = openat(fd, de->d_name, O_NOFOLLOW|O_CLOEXEC|O_PATH);
2404-
if (de_fd < 0)
2405-
q = log_error_errno(errno, "Failed to open() file '%s': %m", de->d_name);
2406-
else {
2404+
if (de_fd < 0) {
2405+
if (errno != -ENOENT)
2406+
q = log_error_errno(errno, "Failed to open file '%s': %m", de->d_name);
2407+
} else {
24072408
_cleanup_free_ char *de_path = NULL;
24082409

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

0 commit comments

Comments
 (0)