]> git.ipfire.org Git - thirdparty/systemd.git/commit
test: fix use of ERRNO_IS_PRIVILEGE() 28384/head
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)
commitfce846e0ace95920155088a7e70dac914e437e68
tree4c0f6f1cc59e0a6996df81ffbf9b7b1cd410a6c5
parent0bdea17c0aa37c4cdf586c072a7b35f8d0598cc3
test: fix use of ERRNO_IS_PRIVILEGE()

Given that ERRNO_IS_PRIVILEGE() also matches positive values,
make sure this macro is not called with arguments that do not have
errno semantics.

In this case the arguments passed to ERRNO_IS_PRIVILEGE() are the values
returned by read_one_line_file() which can legitimately return positive
values without errno semantics, so fix this by moving ERRNO_IS_PRIVILEGE()
invocations to the branches where the return values are known to be negative.
src/test/test-capability.c
src/test/test-fileio.c