teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame SOURCES/0056-boot-Correctly-handle-saved-default-patterns.patch

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