]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared: efivars - is_efi_*() returns bool instead of int
authorTom Gundersen <teg@jklm.no>
Fri, 10 Apr 2015 17:43:36 +0000 (19:43 +0200)
committerTom Gundersen <teg@jklm.no>
Fri, 10 Apr 2015 17:55:49 +0000 (19:55 +0200)
There was a bug where is_efi_*() could return a negative error value, which would be treated as 'true',
just make this a bool in the helper library to avoid the problem.

src/shared/efivars.c
src/shared/efivars.h

index b82f74a459ec58f280ce2652965eb82c61e82424..2a925f3970ab99da2c9e544e0ff22408700bfd00 100644 (file)
@@ -87,12 +87,12 @@ static int read_flag(const char *varname) {
         return r;
 }
 
-int is_efi_secure_boot(void) {
-        return read_flag("SecureBoot");
+bool is_efi_secure_boot(void) {
+        return read_flag("SecureBoot") > 0;
 }
 
-int is_efi_secure_boot_setup_mode(void) {
-        return read_flag("SetupMode");
+bool is_efi_secure_boot_setup_mode(void) {
+        return read_flag("SetupMode") > 0;
 }
 
 int efi_reboot_to_firmware_supported(void) {
index e796bf415dd5de75d25318841d6ca8387b4770f6..420013a61d1a240ac91b6c9543903912d504ac6c 100644 (file)
@@ -33,8 +33,8 @@
 #define EFI_VARIABLE_RUNTIME_ACCESS     0x0000000000000004
 
 bool is_efi_boot(void);
-int is_efi_secure_boot(void);
-int is_efi_secure_boot_setup_mode(void);
+bool is_efi_secure_boot(void);
+bool is_efi_secure_boot_setup_mode(void);
 int efi_reboot_to_firmware_supported(void);
 int efi_get_reboot_to_firmware(void);
 int efi_set_reboot_to_firmware(bool value);