From 38faff48e59284c4bdab9e10d604585bac402171 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 3 Jul 2024 15:36:28 +0200 Subject: [PATCH] boot: don't set OsIndications field if already set correctly --- src/boot/efi/boot.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c index b281136c055..6333cdade6f 100644 --- a/src/boot/efi/boot.c +++ b/src/boot/efi/boot.c @@ -620,16 +620,21 @@ static void print_status(Config *config, char16_t *loaded_image_path) { } static EFI_STATUS set_reboot_into_firmware(void) { - uint64_t osind = 0; EFI_STATUS err; + uint64_t osind = 0; (void) efivar_get_uint64_le(MAKE_GUID_PTR(EFI_GLOBAL_VARIABLE), u"OsIndications", &osind); + + if (FLAGS_SET(osind, EFI_OS_INDICATIONS_BOOT_TO_FW_UI)) + return EFI_SUCCESS; + osind |= EFI_OS_INDICATIONS_BOOT_TO_FW_UI; err = efivar_set_uint64_le(MAKE_GUID_PTR(EFI_GLOBAL_VARIABLE), u"OsIndications", osind, EFI_VARIABLE_NON_VOLATILE); if (err != EFI_SUCCESS) - log_error_status(err, "Error setting OsIndications: %m"); - return err; + return log_error_status(err, "Error setting OsIndications, ignoring: %m"); + + return EFI_SUCCESS; } _noreturn_ static EFI_STATUS poweroff_system(void) { -- 2.47.3