Skip to content

Commit 56c5942

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)
1 parent c5dacda commit 56c5942

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
@@ -2137,7 +2137,7 @@ static int item_do(
21372137
fdaction_t action) {
21382138

21392139
struct stat st;
2140-
int r = 0, q;
2140+
int r = 0, q = 0;
21412141

21422142
assert(i);
21432143
assert(path);
@@ -2171,9 +2171,10 @@ static int item_do(
21712171
continue;
21722172

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

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

0 commit comments

Comments
 (0)