udev_rules_parse_file: do not ignore ENOENT when invoked by udevadm verify

Make sure the ENOENT exception reintroduced by commit
9db7081d83 is not applied when the parser
is invoked by udevadm verify.
This commit is contained in:
Dmitry V. Levin
2023-03-28 20:00:00 +00:00
committed by Yu Watanabe
parent ee2975a9d9
commit 139203e1d4
2 changed files with 3 additions and 1 deletions

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

View File

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