summaryrefslogtreecommitdiffstats
path: root/src/tmpfiles
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2024-05-08 11:35:21 +0200
committerDaan De Meyer <daan.j.demeyer@gmail.com>2024-05-08 12:01:37 +0200
commit677430b3c7fcd1b352eb66f19b8746741459b91a (patch)
treeb19181a41add8fb7d64a97d13f41d60673925080 /src/tmpfiles
parentTEST-74-AUX-UTILS: Make more robust (diff)
downloadsystemd-677430b3c7fcd1b352eb66f19b8746741459b91a.tar.xz
systemd-677430b3c7fcd1b352eb66f19b8746741459b91a.zip
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)
Diffstat (limited to 'src/tmpfiles')
-rw-r--r--src/tmpfiles/tmpfiles.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index ec6d8dcfa1..722dff100a 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -2512,7 +2512,7 @@ static int item_do(
fdaction_t action) {
struct stat st;
- int r = 0, q;
+ int r = 0, q = 0;
assert(c);
assert(i);
@@ -2547,9 +2547,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);