From: Daan De Meyer Date: Tue, 6 Jun 2023 15:23:10 +0000 (+0200) Subject: tmpfiles: Don't log about harmless errors when trying to lock file X-Git-Tag: v254-rc1~155^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=08c25eee3477aab83ac8f4d3237bc628c3ba2615;p=thirdparty%2Fsystemd.git tmpfiles: Don't log about harmless errors when trying to lock file Let's make sure we don't log if the file is a symlink or does not exist. --- diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 9469bbb4a3b..eabac563207 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -510,7 +510,9 @@ static DIR* xopendirat_nomod(int dirfd, const char *path) { if (dir) return dir; - log_debug_errno(errno, "Cannot open %sdirectory \"%s\": %m", dirfd == AT_FDCWD ? "" : "sub", path); + if (!IN_SET(errno, ENOENT, ELOOP)) + log_debug_errno(errno, "Cannot open %sdirectory \"%s\": %m", dirfd == AT_FDCWD ? "" : "sub", path); + if (errno != EPERM) return NULL; @@ -805,7 +807,7 @@ static int dir_cleanup( O_RDONLY|O_CLOEXEC|O_NOFOLLOW|O_NOATIME, /* xopen_flags = */ 0, /* mode = */ 0); - if (fd < 0 && fd != -ENOENT) + if (fd < 0 && !IN_SET(fd, -ENOENT, -ELOOP)) log_warning_errno(fd, "Opening file \"%s\" failed, ignoring: %m", sub_path); if (fd >= 0 && flock(fd, LOCK_EX|LOCK_NB) < 0 && errno == EAGAIN) { log_debug_errno(errno, "Couldn't acquire shared BSD lock on file \"%s\", skipping: %m", sub_path);