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