diff options
author | Dmitry V. Levin <ldv@strace.io> | 2023-07-14 10:00:00 +0200 |
---|---|---|
committer | Dmitry V. Levin <ldv@strace.io> | 2023-07-28 14:28:35 +0200 |
commit | fbce71519598defcf3964754a8c2f292c3180dd9 (patch) | |
tree | 0a2bc425c41ed42a7e1b343eeabd299866c8232e /src/cryptsetup | |
parent | bootctl: cleanup use of ERRNO_IS_NOT_SUPPORTED() (diff) | |
download | systemd-fbce71519598defcf3964754a8c2f292c3180dd9.tar.xz systemd-fbce71519598defcf3964754a8c2f292c3180dd9.zip |
cryptsetup: cleanup use of ERRNO_IS_NOT_SUPPORTED()
Given that ERRNO_IS_NOT_SUPPORTED() 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_NOT_SUPPORTED() is the
value returned by find_tpm2_auto_data() which is not expected to return
any positive values, but let's be consistent anyway and move the
ERRNO_IS_NOT_SUPPORTED() invocation to the branch where
the return value is known to be negative.
Diffstat (limited to 'src/cryptsetup')
-rw-r--r-- | src/cryptsetup/cryptsetup.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c index 31dff24b57..f62401b9bc 100644 --- a/src/cryptsetup/cryptsetup.c +++ b/src/cryptsetup/cryptsetup.c @@ -1728,10 +1728,11 @@ static int attach_luks_or_plain_or_bitlk_by_tpm2( found_some ? "No TPM2 metadata matching the current system state found in LUKS2 header, falling back to traditional unlocking." : "No TPM2 metadata enrolled in LUKS2 header, falling back to traditional unlocking."); - if (ERRNO_IS_NOT_SUPPORTED(r)) /* TPM2 support not compiled in? */ - return log_debug_errno(SYNTHETIC_ERRNO(EAGAIN), "TPM2 support not available, falling back to traditional unlocking."); - if (r < 0) + if (r < 0) { + if (ERRNO_IS_NOT_SUPPORTED(r)) /* TPM2 support not compiled in? */ + return log_debug_errno(SYNTHETIC_ERRNO(EAGAIN), "TPM2 support not available, falling back to traditional unlocking."); return r; + } found_some = true; |