From: Dmitry V. Levin Date: Thu, 18 May 2023 17:00:00 +0000 (+0000) Subject: udev-rules: avoid issuing redundant diagnostics in verify mode X-Git-Tag: v254-rc1~434^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f366434090cee751712b89fe2e315797ecdfa066;p=thirdparty%2Fsystemd.git udev-rules: avoid issuing redundant diagnostics in verify mode When udevadm verify is given an argument that doesn't point to an existing file, there used to be two diagnostics messages, the first one at a warning level, and the second one at an error level: $ build/udevadm verify /no/such/directory Failed to open /no/such/directory, ignoring: No such file or directory Failed to parse rules file /no/such/directory: No such file or directory Fix this by issuing just the error message. --- diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index fc1ef34964e..e5a25bd1191 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -1454,7 +1454,10 @@ int udev_rules_parse_file(UdevRules *rules, const char *filename, bool extra_che f = fopen(filename, "re"); if (!f) { - if (!extra_checks && errno == ENOENT) + if (extra_checks) + return -errno; + + if (errno == ENOENT) return 0; return log_warning_errno(errno, "Failed to open %s, ignoring: %m", filename);