From: Lennart Poettering Date: Mon, 1 Apr 2019 18:13:36 +0000 (+0200) Subject: fs-util: suppress world-writable warnings if we read /dev/null X-Git-Tag: v242-rc1~28 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fsystemd.git;a=commitdiff_plain;h=b6cceaae300467af6946534cf745bb549da1050f fs-util: suppress world-writable warnings if we read /dev/null Fixes: #12165 --- 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);