summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-07-11 17:29:48 -0300
committerLennart Poettering <lennart@poettering.net>2015-07-11 17:32:25 -0300
commit6b62bbbc7b53bee11778d27d18e9506d9b42d4ba (patch)
tree6ddf5324b40c6821f2dc7a12edeea1b8d826d6cd /src/shared
parent6f9d58d87fa2b728c1d08f74e9f17c581513516c (diff)
downloadsystemd-6b62bbbc7b53bee11778d27d18e9506d9b42d4ba.tar.gz
systemd-6b62bbbc7b53bee11778d27d18e9506d9b42d4ba.tar.bz2
systemd-6b62bbbc7b53bee11778d27d18e9506d9b42d4ba.zip
logind: some firmware implementations remove OsIndications if it is unset
We shouldn't fall over that, and just assume it is 0 in this case. Fixes #499.
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/efivars.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/shared/efivars.c b/src/shared/efivars.c
index 0d6ecf52cf..347cd30b09 100644
--- a/src/shared/efivars.c
+++ b/src/shared/efivars.c
@@ -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;