ac3a84
From f740d67fd0ed36bc3318d724ccb1fdfca2f04125 Mon Sep 17 00:00:00 2001
ac3a84
From: Jan Janssen <medhefgo@web.de>
ac3a84
Date: Sun, 4 Sep 2022 00:22:23 +0200
ac3a84
Subject: [PATCH] boot: Correctly handle @saved default patterns
ac3a84
ac3a84
(cherry picked from commit 7941f11acb67c4f8ec857a791a51f3148af67b32)
ac3a84
ac3a84
Related: #2138081
ac3a84
---
ac3a84
 src/shared/bootspec.c | 6 ++++++
ac3a84
 1 file changed, 6 insertions(+)
ac3a84
ac3a84
diff --git a/src/shared/bootspec.c b/src/shared/bootspec.c
ac3a84
index 6a34b10c04..d3cfb41a12 100644
ac3a84
--- a/src/shared/bootspec.c
ac3a84
+++ b/src/shared/bootspec.c
ac3a84
@@ -994,6 +994,12 @@ static int boot_config_find(const BootConfig *config, const char *id) {
ac3a84
         if (!id)
ac3a84
                 return -1;
ac3a84
 
ac3a84
+        if (id[0] == '@') {
ac3a84
+                if (!strcaseeq(id, "@saved"))
ac3a84
+                        return -1;
ac3a84
+                id = config->entry_selected;
ac3a84
+        }
ac3a84
+
ac3a84
         for (size_t i = 0; i < config->n_entries; i++)
ac3a84
                 if (fnmatch(id, config->entries[i].id, FNM_CASEFOLD) == 0)
ac3a84
                         return i;