diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-03-28 18:42:24 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-03-28 18:42:24 +0200 |
commit | 9db7081d83d56cd2523b03f9eb9d67ef1c93c55f (patch) | |
tree | ab87e011d05285961c8ca889ffc94c291b5b99df /src/udev | |
parent | 201423d80144d60b48144c6283d669b63a80aabe (diff) | |
download | systemd-9db7081d83d56cd2523b03f9eb9d67ef1c93c55f.tar.gz |
Revert "udev_rules_parse_file: do not skip ENOENT"
This reverts commit 42a467b55219384c7c3b137ab3cc8b6a309a8a14.
We need to skip -ENOENT when loading udev rules because new files with rules
may be added or removed at any time, and the loading of rules is triggered
asynchronously. Even though the window is fairly narrow, udev shouldn't throw
an error if a rules file is removed.
Diffstat (limited to 'src/udev')
-rw-r--r-- | src/udev/udev-rules.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index f7a1bb3bb0..a019f64c6c 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); |