Skip to content

Commit

Permalink
tmpfiles: Don't fail if file does not exist in item_do()
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
DaanDeMeyer authored and bluca committed May 9, 2024
1 parent 6b56cc8 commit 3abc0cb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/tmpfiles/tmpfiles.c
Original file line number Diff line number Diff line change
Expand Up @@ -2289,7 +2289,7 @@ static int item_do(
fdaction_t action) {

struct stat st;
int r = 0, q;
int r = 0, q = 0;

assert(i);
assert(path);
Expand Down Expand Up @@ -2323,9 +2323,10 @@ static int item_do(
continue;

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

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

0 comments on commit 3abc0cb

Please sign in to comment.