shared/bootspec: treat empty EFI vars as missing

We shouldn't really make any fuss about this. Also, change 'var' to 'variable'
for consistency with systemctl.c.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2019-03-06 22:45:37 +01:00
parent f40999f878
commit 1f18d94215
2 changed files with 5 additions and 5 deletions

View File

@@ -664,12 +664,12 @@ int boot_entries_load_config(
if (is_efi_boot()) {
r = efi_get_variable_string(EFI_VENDOR_LOADER, "LoaderEntryOneShot", &config->entry_oneshot);
if (r < 0 && r != -ENOENT)
return log_error_errno(r, "Failed to read EFI var \"LoaderEntryOneShot\": %m");
if (r < 0 && !IN_SET(r, -ENOENT, -ENODATA))
return log_error_errno(r, "Failed to read EFI variable \"LoaderEntryOneShot\": %m");
r = efi_get_variable_string(EFI_VENDOR_LOADER, "LoaderEntryDefault", &config->entry_default);
if (r < 0 && r != -ENOENT)
return log_error_errno(r, "Failed to read EFI var \"LoaderEntryDefault\": %m");
if (r < 0 && !IN_SET(r, -ENOENT, -ENODATA))
return log_error_errno(r, "Failed to read EFI variable \"LoaderEntryDefault\": %m");
}
config->default_entry = boot_entries_select_default(config);

View File

@@ -223,7 +223,7 @@ int efi_get_variable(
if (fstat(fd, &st) < 0)
return -errno;
if (st.st_size < 4)
return -EIO;
return -ENODATA;
if (st.st_size > 4*1024*1024 + 4)
return -E2BIG;