diff options
author | Lennart Poettering <lennart@poettering.net> | 2022-03-24 17:06:16 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2022-03-28 16:01:54 +0200 |
commit | d412691a91fc29e2a8204fe4b3494426fbb76cac (patch) | |
tree | 83c2adfe986ac7fcb2b31393d1d0926a58db57c4 /src | |
parent | bootspec: assess default/selected entries *after* we augmented entry list wit... (diff) | |
download | systemd-d412691a91fc29e2a8204fe4b3494426fbb76cac.tar.xz systemd-d412691a91fc29e2a8204fe4b3494426fbb76cac.zip |
bootctl: use boot_config_default_entry() where appropriate
Diffstat (limited to 'src')
-rw-r--r-- | src/boot/bootctl.c | 2 | ||||
-rw-r--r-- | src/shared/bootspec.h | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/boot/bootctl.c b/src/boot/bootctl.c index 5c1d2533d7..2766c8452f 100644 --- a/src/boot/bootctl.c +++ b/src/boot/bootctl.c @@ -723,7 +723,7 @@ static int status_entries( printf("Default Boot Loader Entry:\n"); r = boot_entry_show( - config.entries + config.default_entry, + boot_config_default_entry(&config), /* show_as_default= */ false, /* show_as_selected= */ false, /* show_discovered= */ false); diff --git a/src/shared/bootspec.h b/src/shared/bootspec.h index 5c4b211ee4..0f199d5ee9 100644 --- a/src/shared/bootspec.h +++ b/src/shared/bootspec.h @@ -56,6 +56,7 @@ typedef struct BootConfig { BootEntry *entries; size_t n_entries; + ssize_t default_entry; ssize_t selected_entry; @@ -86,10 +87,12 @@ static inline BootEntry* boot_config_default_entry(BootConfig *config) { if (config->default_entry < 0) return NULL; + assert((size_t) config->default_entry < config->n_entries); return config->entries + config->default_entry; } void boot_config_free(BootConfig *config); + int boot_entries_load_config(const char *esp_path, const char *xbootldr_path, BootConfig *config); int boot_entries_load_config_auto(const char *override_esp_path, const char *override_xbootldr_path, BootConfig *config); int boot_entries_augment_from_loader(BootConfig *config, char **list, bool only_auto); |