From b6cceaae300467af6946534cf745bb549da1050f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 1 Apr 2019 20:13:36 +0200 Subject: [PATCH] fs-util: suppress world-writable warnings if we read /dev/null Fixes: #12165 --- src/basic/fs-util.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c index ce1f5454c83..9f3fd456911 100644 --- a/src/basic/fs-util.c +++ b/src/basic/fs-util.c @@ -353,6 +353,10 @@ int fd_warn_permissions(const char *path, int fd) { if (fstat(fd, &st) < 0) return -errno; + /* Don't complain if we are reading something that is not a file, for example /dev/null */ + if (!S_ISREG(st.st_mode)) + return 0; + if (st.st_mode & 0111) log_warning("Configuration file %s is marked executable. Please remove executable permission bits. Proceeding anyway.", path); -- 2.39.2