nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0126-Only-attempt-to-scan-different-BLS-directories-on-EF.patch

8631a2
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
8631a2
From: Javier Martinez Canillas <javierm@redhat.com>
8631a2
Date: Tue, 3 Apr 2018 15:42:47 +0200
8631a2
Subject: [PATCH] Only attempt to scan different BLS directories on EFI
8631a2
 machines
8631a2
8631a2
Current BLS support attempted to scan for BLS directories, but this only
8631a2
makes sense on EFI, where BLS fragments are in /loader/$vendor/entries.
8631a2
8631a2
For BIOS, only either the default /loader/entries path should be scanned
8631a2
or the BLS directory defined in the blsdir GRUB 2 environment variable.
8631a2
8631a2
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
8631a2
---
8631a2
 grub-core/commands/blscfg.c | 9 ++++-----
8631a2
 1 file changed, 4 insertions(+), 5 deletions(-)
8631a2
8631a2
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
8631a2
index e0b65534af4..e775c6b8794 100644
8631a2
--- a/grub-core/commands/blscfg.c
8631a2
+++ b/grub-core/commands/blscfg.c
8631a2
@@ -676,8 +676,8 @@ static int find_entry (const char *filename,
8631a2
   const char *devid = grub_env_get ("boot");
8631a2
 
8631a2
   grub_dprintf("blscfg", "%s got here\n", __func__);
8631a2
-  if (!grub_strcmp (filename, ".") ||
8631a2
-      !grub_strcmp (filename, ".."))
8631a2
+  if (filename && (!grub_strcmp (filename, ".") ||
8631a2
+		   !grub_strcmp (filename, "..")))
8631a2
     return 0;
8631a2
 
8631a2
   if (info->platform == PLATFORM_EFI && !grub_strcasecmp (filename, "boot"))
8631a2
@@ -872,11 +872,10 @@ grub_cmd_blscfg (grub_extcmd_context_t ctxt UNUSED,
8631a2
   info.platform = PLATFORM_EMU;
8631a2
   grub_dprintf ("blscfg", "scanning %s%s\n", GRUB_BOOT_DEVICE,
8631a2
 		GRUB_BLS_CONFIG_PATH);
8631a2
-  r = fs->dir (dev, "/boot/loader/",
8631a2
-	       find_entry, &info;;
8631a2
+  find_entry(NULL, NULL, &info;;
8631a2
 #else
8631a2
   grub_dprintf ("blscfg", "scanning %s\n", GRUB_BLS_CONFIG_PATH);
8631a2
-  r = fs->dir (dev, "/", find_entry, &info;;
8631a2
+  find_entry(NULL, NULL, &info;;
8631a2
 #endif
8631a2
 
8631a2
 finish: