diff options
author | Daniel Fullmer <danielrf12@gmail.com> | 2020-04-23 14:47:56 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-09-20 12:47:51 +0200 |
commit | 02a42a3ff1468e8d04abccba1cc1da46b8a1cfe3 (patch) | |
tree | d7f3824467de556b2a22911a0e625f439cc6634f /src | |
parent | aa923cab34330b99b7031a7b669d7b6d28927533 (diff) | |
download | systemd-02a42a3ff1468e8d04abccba1cc1da46b8a1cfe3.tar.gz |
sd-boot: fix menu ordering with boot counting
systemd-boot selects the last valid entry by default, not the first.
Fixes: #15256
(cherry picked from commit e6190e2882e1d6772a9e586fcc65c91d406e52fb)
(cherry picked from commit c5883bc08877d8bad10110434037a3c21950a71a)
(cherry picked from commit f047b0706c01f99c1b781f44b7b4d95ecdb8abe2)
Diffstat (limited to 'src')
-rw-r--r-- | src/boot/efi/boot.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c index ef7ad66eb9..2a84abe131 100644 --- a/src/boot/efi/boot.c +++ b/src/boot/efi/boot.c @@ -1512,11 +1512,11 @@ static VOID config_load_entries( static INTN config_entry_compare(ConfigEntry *a, ConfigEntry *b) { INTN r; - /* Order entries that have no tries left to the end of the list */ + /* Order entries that have no tries left to the beginning of the list */ if (a->tries_left != 0 && b->tries_left == 0) - return -1; - if (a->tries_left == 0 && b->tries_left != 0) return 1; + if (a->tries_left == 0 && b->tries_left != 0) + return -1; r = str_verscmp(a->id, b->id); if (r != 0) @@ -1526,17 +1526,17 @@ static INTN config_entry_compare(ConfigEntry *a, ConfigEntry *b) { b->tries_left == (UINTN) -1) return 0; - /* If both items have boot counting, and otherwise are identical, put the entry with more tries left first */ + /* If both items have boot counting, and otherwise are identical, put the entry with more tries left last */ if (a->tries_left > b->tries_left) - return -1; - if (a->tries_left < b->tries_left) return 1; + if (a->tries_left < b->tries_left) + return -1; /* If they have the same number of tries left, then let the one win which was tried fewer times so far */ if (a->tries_done < b->tries_done) - return -1; - if (a->tries_done > b->tries_done) return 1; + if (a->tries_done > b->tries_done) + return -1; return 0; } |