grub2/0240-fw_path-don-t-prepend-unless-we-re-on-http-s.patch
Peter Jones 371309b06e More bug "fixes"...
Don't mangle fw_path even harder.
  Resolves: rhbz#1626844
Fix reboot being missing on some platforms, and make it alias to
  "reset" as well.
More dprintf().

Signed-off-by: Peter Jones <pjones@redhat.com>
2018-09-11 11:07:08 -04:00

35 lines
1.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Mon, 10 Sep 2018 17:29:21 -0400
Subject: [PATCH] fw_path: don't prepend / unless we're on http(s)
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/kern/main.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c
index fc8d8c6c9d4..dcf48726d54 100644
--- a/grub-core/kern/main.c
+++ b/grub-core/kern/main.c
@@ -130,11 +130,19 @@ grub_set_prefix_and_root (void)
if (fwdevice && fwpath)
{
char *fw_path;
+ char separator[3] = ")";
- fw_path = grub_xasprintf ("(%s)%s%s", fwdevice, fwpath[0] == '/' ? "" : "/", fwpath);
+ grub_dprintf ("fw_path", "\n");
+ grub_dprintf ("fw_path", "fwdevice:\"%s\" fwpath:\"%s\"\n", fwdevice, fwpath);
+
+ if (!grub_strncmp(fwdevice, "http", 4) && fwpath[0] != '/')
+ grub_strcpy(separator, ")/");
+
+ fw_path = grub_xasprintf ("(%s%s%s", fwdevice, separator, fwpath);
if (fw_path)
{
grub_env_set ("fw_path", fw_path);
+ grub_dprintf ("fw_path", "fw_path:\"%s\"\n", fw_path);
grub_free (fw_path);
}
}