From: Lennart Poettering Date: Fri, 22 Jun 2018 16:40:43 +0000 (+0200) Subject: efi: detect containers in is_efi_boot() X-Git-Tag: v240~610^2~20 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bb161cdc24632e2002d9e8151ead5686b521c942;p=thirdparty%2Fsystemd.git efi: detect containers in is_efi_boot() Let's make sure that we never assume we booted up in EFI mode if we are run in a container. --- diff --git a/src/shared/efivars.c b/src/shared/efivars.c index e96748efde0..d4acfebf680 100644 --- a/src/shared/efivars.c +++ b/src/shared/efivars.c @@ -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);