Skip to content

Commit 3abc0cb

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)
1 parent 6b56cc8 commit 3abc0cb

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
@@ -2289,7 +2289,7 @@ static int item_do(
22892289
fdaction_t action) {
22902290

22912291
struct stat st;
2292-
int r = 0, q;
2292+
int r = 0, q = 0;
22932293

22942294
assert(i);
22952295
assert(path);
@@ -2323,9 +2323,10 @@ static int item_do(
23232323
continue;
23242324

23252325
de_fd = openat(fd, de->d_name, O_NOFOLLOW|O_CLOEXEC|O_PATH);
2326-
if (de_fd < 0)
2327-
q = log_error_errno(errno, "Failed to open() file '%s': %m", de->d_name);
2328-
else {
2326+
if (de_fd < 0) {
2327+
if (errno != -ENOENT)
2328+
q = log_error_errno(errno, "Failed to open file '%s': %m", de->d_name);
2329+
} else {
23292330
_cleanup_free_ char *de_path = NULL;
23302331

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

0 commit comments

Comments
 (0)