From 3dadc118aa72b52f610d20fae4da57e8edd0a7e0 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Fri, 14 Jul 2023 08:00:00 +0000 Subject: [PATCH] bootctl: 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 efi_loader_get_entries() 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. --- src/boot/bootctl-status.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/boot/bootctl-status.c b/src/boot/bootctl-status.c index 0f2e9204b7a..65f351031d7 100644 --- a/src/boot/bootctl-status.c +++ b/src/boot/bootctl-status.c @@ -43,11 +43,12 @@ static int boot_config_load_and_select( _cleanup_strv_free_ char **efi_entries = NULL; r = efi_loader_get_entries(&efi_entries); - if (r == -ENOENT || ERRNO_IS_NOT_SUPPORTED(r)) - log_debug_errno(r, "Boot loader reported no entries."); - else if (r < 0) - log_warning_errno(r, "Failed to determine entries reported by boot loader, ignoring: %m"); - else + if (r < 0) { + if (r == -ENOENT || ERRNO_IS_NOT_SUPPORTED(r)) + log_debug_errno(r, "Boot loader reported no entries."); + else + log_warning_errno(r, "Failed to determine entries reported by boot loader, ignoring: %m"); + } else (void) boot_config_augment_from_loader(config, efi_entries, /* only_auto= */ false); } -- 2.47.3