]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-boot: select newest kernel entry matching with the default glob pattern
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 5 Jan 2022 06:09:43 +0000 (15:09 +0900)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 5 Jan 2022 11:15:24 +0000 (12:15 +0100)
This fixes a bug introduced by 0c674ce5f24a6e52561ec6520e43a1ca45d90f01.

Fixes #22004.

src/boot/efi/boot.c

index 2c5bd913d2786f78394d7a1f1cfaab675dec6579..9935f2e879559c09782a54c1621c37dd3a4642f0 100644 (file)
@@ -1638,9 +1638,9 @@ static INTN config_entry_find(Config *config, const CHAR16 *needle) {
         if (!needle)
                 return -1;
 
-        for (UINTN i = 0; i < config->entry_count; i++)
+        for (INTN i = config->entry_count - 1; i >= 0; i--)
                 if (MetaiMatch(config->entries[i]->id, (CHAR16*) needle))
-                        return (INTN) i;
+                        return i;
 
         return -1;
 }