]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev_rules_parse_file: do not ignore ENOENT when invoked by udevadm verify
authorDmitry V. Levin <ldv@strace.io>
Tue, 28 Mar 2023 20:00:00 +0000 (20:00 +0000)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 29 Mar 2023 09:50:29 +0000 (18:50 +0900)
Make sure the ENOENT exception reintroduced by commit
9db7081d83d56cd2523b03f9eb9d67ef1c93c55f is not applied when the parser
is invoked by udevadm verify.

src/udev/udev-rules.c
test/units/testsuite-17.11.sh

index a019f64c6c7e9e1fbe8ab82b491c9aadd7a58cd6..bbdd498cd718f5fcf3e0e928b95e548d02907733 100644 (file)
@@ -1437,7 +1437,7 @@ int udev_rules_parse_file(UdevRules *rules, const char *filename, bool extra_che
 
         f = fopen(filename, "re");
         if (!f) {
-                if (errno == ENOENT)
+                if (!extra_checks && errno == ENOENT)
                         return 0;
 
                 return log_warning_errno(errno, "Failed to open %s, ignoring: %m", filename);
index ba21c9ab87a22ff5b24ca927a8a7a8d5a95a44c4..e3a96e5cdb7e734cea1847bff63e84fad0625802 100755 (executable)
@@ -97,6 +97,8 @@ assert_1 --resolve-names=now
 # Failed to parse rules file .: Is a directory
 cp "${workdir}/default_output_1_fail" "${exo}"
 assert_1 .
+# Failed to parse rules file ./nosuchfile: No such file or directory
+assert_1 ./nosuchfile
 # Failed to parse rules file .: Is a directory
 cat >"${exo}" <<EOF