diff options
author | Dmitry V. Levin <ldv@strace.io> | 2023-05-18 19:00:00 +0200 |
---|---|---|
committer | Dmitry V. Levin <ldv@strace.io> | 2023-05-18 19:00:00 +0200 |
commit | f366434090cee751712b89fe2e315797ecdfa066 (patch) | |
tree | dbd82265a69449929d35f214b19fab370d2b985d /src | |
parent | testsuite-17.11.sh: fix assert_1() (diff) | |
download | systemd-f366434090cee751712b89fe2e315797ecdfa066.tar.xz systemd-f366434090cee751712b89fe2e315797ecdfa066.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/udev/udev-rules.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index fc1ef34964..e5a25bd119 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); |