From 139203e1d4d0a665de65c97fb1578330d5ee9dfc Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Tue, 28 Mar 2023 20:00:00 +0000 Subject: [PATCH] udev_rules_parse_file: do not ignore ENOENT when invoked by udevadm verify 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 | 2 +- test/units/testsuite-17.11.sh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index a019f64c6c7..bbdd498cd71 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -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); diff --git a/test/units/testsuite-17.11.sh b/test/units/testsuite-17.11.sh index ba21c9ab87a..e3a96e5cdb7 100755 --- a/test/units/testsuite-17.11.sh +++ b/test/units/testsuite-17.11.sh @@ -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}" <