]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Revert "udev_rules_parse_file: do not skip ENOENT"
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 28 Mar 2023 16:42:24 +0000 (18:42 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 28 Mar 2023 16:42:24 +0000 (18:42 +0200)
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.

src/udev/udev-rules.c

index f7a1bb3bb00d6aa431ff0a405ce6fb986b62c3ae..a019f64c6c7e9e1fbe8ab82b491c9aadd7a58cd6 100644 (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);