fs-util: suppress world-writable warnings if we read /dev/null

Fixes: #12165
This commit is contained in:
Lennart Poettering 2019-04-01 20:13:36 +02:00 committed by Zbigniew Jędrzejewski-Szmek
parent c0b471e197
commit b6cceaae30
1 changed files with 4 additions and 0 deletions

View 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);