Merge pull request #27040 from keszybz/empty-path-skip-cleanup

Restore silent skipping of missing rules files by udev
This commit is contained in:
Yu Watanabe
2023-03-29 10:18:06 +09:00
committed by GitHub
4 changed files with 6 additions and 14 deletions

View File

@@ -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;

View File

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

View File

@@ -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;
}

View File

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