dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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