diff options
author | Lennart Poettering <lennart@poettering.net> | 2022-03-23 17:15:23 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2022-03-28 16:01:32 +0200 |
commit | 92067ab672f1fcdfd31dfd41f6bca37e2fcc9e95 (patch) | |
tree | 15c2734a40a98a5b14f3bf542aff323f612daa16 /src | |
parent | bootspec: rename type1 parsers to say "type1" explicitly in the name (diff) | |
download | systemd-92067ab672f1fcdfd31dfd41f6bca37e2fcc9e95.tar.xz systemd-92067ab672f1fcdfd31dfd41f6bca37e2fcc9e95.zip |
bootspec: normalize oom handling in boot_load_efi_entry_pointers()
OOM should usually be fatal, hence make it so here, too.
Diffstat (limited to 'src')
-rw-r--r-- | src/shared/bootspec.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/src/shared/bootspec.c b/src/shared/bootspec.c index 448d65f7e4..52a1612f3d 100644 --- a/src/shared/bootspec.c +++ b/src/shared/bootspec.c @@ -799,25 +799,22 @@ static int boot_load_efi_entry_pointers(BootConfig *config) { /* Loads the three "pointers" to boot loader entries from their EFI variables */ r = efi_get_variable_string(EFI_LOADER_VARIABLE(LoaderEntryOneShot), &config->entry_oneshot); - if (r < 0 && !IN_SET(r, -ENOENT, -ENODATA)) { - log_warning_errno(r, "Failed to read EFI variable \"LoaderEntryOneShot\": %m"); - if (r == -ENOMEM) - return r; - } + if (r == -ENOMEM) + return log_oom(); + if (r < 0 && !IN_SET(r, -ENOENT, -ENODATA)) + log_warning_errno(r, "Failed to read EFI variable \"LoaderEntryOneShot\", ignoring: %m"); r = efi_get_variable_string(EFI_LOADER_VARIABLE(LoaderEntryDefault), &config->entry_default); - if (r < 0 && !IN_SET(r, -ENOENT, -ENODATA)) { - log_warning_errno(r, "Failed to read EFI variable \"LoaderEntryDefault\": %m"); - if (r == -ENOMEM) - return r; - } + if (r == -ENOMEM) + return log_oom(); + if (r < 0 && !IN_SET(r, -ENOENT, -ENODATA)) + log_warning_errno(r, "Failed to read EFI variable \"LoaderEntryDefault\", ignoring: %m"); r = efi_get_variable_string(EFI_LOADER_VARIABLE(LoaderEntrySelected), &config->entry_selected); - if (r < 0 && !IN_SET(r, -ENOENT, -ENODATA)) { - log_warning_errno(r, "Failed to read EFI variable \"LoaderEntrySelected\": %m"); - if (r == -ENOMEM) - return r; - } + if (r == -ENOMEM) + return log_oom(); + if (r < 0 && !IN_SET(r, -ENOENT, -ENODATA)) + log_warning_errno(r, "Failed to read EFI variable \"LoaderEntrySelected\", ignoring: %m"); return 1; } |