]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
efi: detect containers in is_efi_boot()
authorLennart Poettering <lennart@poettering.net>
Fri, 22 Jun 2018 16:40:43 +0000 (18:40 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 8 Oct 2018 19:40:44 +0000 (21:40 +0200)
Let's make sure that we never assume we booted up in EFI mode if we are
run in a container.

src/shared/efivars.c

index e96748efde0cb5e44f25062be12282c5f5faea54..d4acfebf680a53f0233b5d14fc3ea0f54b029ef7 100644 (file)
@@ -63,7 +63,10 @@ struct device_path {
 } _packed_;
 
 bool is_efi_boot(void) {
-        return access("/sys/firmware/efi", F_OK) >= 0;
+        if (detect_container() > 0)
+                return false;
+
+        return access("/sys/firmware/efi/", F_OK) >= 0;
 }
 
 static int read_flag(const char *varname) {
@@ -97,7 +100,7 @@ int efi_reboot_to_firmware_supported(void) {
         size_t s;
         int r;
 
-        if (!is_efi_boot() || detect_container() > 0)
+        if (!is_efi_boot())
                 return -EOPNOTSUPP;
 
         r = efi_get_variable(EFI_VENDOR_GLOBAL, "OsIndicationsSupported", NULL, &v, &s);