kbd-util: fix use of ERRNO_IS_RESOURCE()
authorDmitry V. Levin <ldv@strace.io>
Fri, 7 Jul 2023 08:00:00 +0000 (08:00 +0000)
committerDmitry V. Levin <ldv@strace.io>
Sun, 16 Jul 2023 10:53:30 +0000 (10:53 +0000)
commited3745b51cd823d4a651e250050b2b674f055585
tree9639e37fa2346be5a88df819faaf4bf3778abfd8
parentd98037166929b87ed119a1560d398a9460113eb7
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.
src/shared/kbd-util.c