]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fs-util: suppress world-writable warnings if we read /dev/null
authorLennart Poettering <lennart@poettering.net>
Mon, 1 Apr 2019 18:13:36 +0000 (20:13 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 1 Apr 2019 20:07:41 +0000 (22:07 +0200)
Fixes: #12165
src/basic/fs-util.c

index ce1f5454c83e1ba5a67d8067a0a2e4fb0ee204d7..9f3fd4569111ba8e1700a7b9170fc52bb8e8f69f 100644 (file)
@@ -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);