summaryrefslogtreecommitdiffstats
path: root/src/shared
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@strace.io>2023-07-07 10:00:00 +0200
committerDmitry V. Levin <ldv@strace.io>2023-07-16 12:53:30 +0200
commited3745b51cd823d4a651e250050b2b674f055585 (patch)
tree9639e37fa2346be5a88df819faaf4bf3778abfd8 /src/shared
parenttest: avoid TEST-70 passphrase and password file mode complaints (diff)
downloadsystemd-ed3745b51cd823d4a651e250050b2b674f055585.tar.xz
systemd-ed3745b51cd823d4a651e250050b2b674f055585.zip
kbd-util: fix use of ERRNO_IS_RESOURCE()
Given that ERRNO_IS_RESOURCE() also matches positive values, make sure this macro is not called with arguments that do not have errno semantics. In this case the argument passed to ERRNO_IS_RESOURCE() is the value returned by recurse_dir_at() which can legitimately return positive values without errno semantics, so fix this by moving the ERRNO_IS_RESOURCE() invocation to the branch where the return value is known to be negative.
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/kbd-util.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/shared/kbd-util.c b/src/shared/kbd-util.c
index 3100862548..e6fe973471 100644
--- a/src/shared/kbd-util.c
+++ b/src/shared/kbd-util.c
@@ -145,11 +145,11 @@ int keymap_exists(const char *name) {
&(struct recurse_dir_userdata) {
.keymap_name = name,
});
- if (r == -ENOENT)
- continue;
- if (ERRNO_IS_RESOURCE(r))
- return r;
if (r < 0) {
+ if (r == -ENOENT)
+ continue;
+ if (ERRNO_IS_RESOURCE(r))
+ return r;
log_debug_errno(r, "Failed to read keymap list from %s, ignoring: %m", dir);
continue;
}