]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
logind: some firmware implementations remove OsIndications if it is unset 559/head
authorLennart Poettering <lennart@poettering.net>
Sat, 11 Jul 2015 20:29:48 +0000 (17:29 -0300)
committerLennart Poettering <lennart@poettering.net>
Sat, 11 Jul 2015 20:32:25 +0000 (17:32 -0300)
We shouldn't fall over that, and just assume it is 0 in this case.

Fixes #499.

src/shared/efivars.c

index 0d6ecf52cfe690bf59725648d0d4474c2bdfd718..347cd30b09dd41558039d6b4301e5f55a0e9d798 100644 (file)
@@ -125,7 +125,19 @@ static int get_os_indications(uint64_t *os_indication) {
                 return r;
 
         r = efi_get_variable(EFI_VENDOR_GLOBAL, "OsIndications", NULL, &v, &s);
-        if (r < 0)
+        if (r == -ENOENT) {
+                /* Some firmware implementations that do support
+                 * OsIndications and report that with
+                 * OsIndicationsSupported will remove the
+                 * OsIndications variable when it is unset. Let's
+                 * pretend it's 0 then, to hide this implementation
+                 * detail. Note that this call will return -ENOENT
+                 * then only if the support for OsIndications is
+                 * missing entirely, as determined by
+                 * efi_reboot_to_firmware_supported() above. */
+                *os_indication = 0;
+                return 0;
+        } else if (r < 0)
                 return r;
         else if (s != sizeof(uint64_t))
                 return -EINVAL;