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