From: Dmitry V. Levin Date: Fri, 14 Jul 2023 08:00:00 +0000 (+0000) Subject: logind: cleanup use of ERRNO_IS_NOT_SUPPORTED() X-Git-Tag: v255-rc1~886^2~9 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1209bf754cb061cfaad5ee730ba18f104bdeae09;p=thirdparty%2Fsystemd.git logind: 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. --- diff --git a/src/login/logind-core.c b/src/login/logind-core.c index af86e92c016..e7f1d6c8e4e 100644 --- a/src/login/logind-core.c +++ b/src/login/logind-core.c @@ -828,13 +828,14 @@ int manager_read_efi_boot_loader_entries(Manager *m) { return 0; r = efi_loader_get_entries(&m->efi_boot_loader_entries); - if (r == -ENOENT || ERRNO_IS_NOT_SUPPORTED(r)) { - log_debug_errno(r, "Boot loader reported no entries."); - m->efi_boot_loader_entries_set = true; - return 0; - } - if (r < 0) + if (r < 0) { + if (r == -ENOENT || ERRNO_IS_NOT_SUPPORTED(r)) { + log_debug_errno(r, "Boot loader reported no entries."); + m->efi_boot_loader_entries_set = true; + return 0; + } return log_error_errno(r, "Failed to determine entries reported by boot loader: %m"); + } m->efi_boot_loader_entries_set = true; return 1;