diff --git a/src/basic/stat-util.c b/src/basic/stat-util.c index 150605e86d5..6eaa3da4592 100644 --- a/src/basic/stat-util.c +++ b/src/basic/stat-util.c @@ -152,17 +152,6 @@ int null_or_empty_path_with_root(const char *fn, const char *root) { return null_or_empty(&st); } -int null_or_empty_fd(int fd) { - struct stat st; - - assert(fd >= 0); - - if (fstat(fd, &st) < 0) - return -errno; - - return null_or_empty(&st); -} - static int fd_is_read_only_fs(int fd) { struct statvfs st; diff --git a/src/basic/stat-util.h b/src/basic/stat-util.h index 4bf15a731d9..24684d5794a 100644 --- a/src/basic/stat-util.h +++ b/src/basic/stat-util.h @@ -30,7 +30,6 @@ static inline int dir_is_empty(const char *path, bool ignore_hidden_or_backup) { bool null_or_empty(struct stat *st) _pure_; int null_or_empty_path_with_root(const char *fn, const char *root); -int null_or_empty_fd(int fd); static inline int null_or_empty_path(const char *fn) { return null_or_empty_path_with_root(fn, NULL); diff --git a/src/shared/exec-util.c b/src/shared/exec-util.c index ac68cbc4cb1..a2e8f428e69 100644 --- a/src/shared/exec-util.c +++ b/src/shared/exec-util.c @@ -39,7 +39,7 @@ static int do_spawn(const char *path, char *argv[], int stdout_fd, pid_t *pid, b pid_t _pid; int r; - if (null_or_empty_path(path)) { + if (null_or_empty_path(path) > 0) { log_debug("%s is empty (a mask).", path); return 0; } diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index f7a1bb3bb00..a019f64c6c7 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -1436,8 +1436,12 @@ int udev_rules_parse_file(UdevRules *rules, const char *filename, bool extra_che assert(filename); f = fopen(filename, "re"); - if (!f) + if (!f) { + if (errno == ENOENT) + return 0; + return log_warning_errno(errno, "Failed to open %s, ignoring: %m", filename); + } if (fstat(fileno(f), &st) < 0) return log_warning_errno(errno, "Failed to stat %s, ignoring: %m", filename);