grub2/0172-grub-core-kern-main.c-grub_set_prefix_and_root-Strip.patch
Peter Jones f74b50e380 Rebase to upstream, fix a pile of bugs. The usual.
Signed-off-by: Peter Jones <pjones@redhat.com>
2013-06-12 15:37:08 -04:00

50 lines
1.6 KiB
Diff

From 7a75aadaef0e9d8d36e4c24e906b36336854db7e Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Fri, 1 Mar 2013 10:35:51 +0100
Subject: [PATCH 172/482] * grub-core/kern/main.c
(grub_set_prefix_and_root): Strip trailing platform from firmware path.
---
ChangeLog | 5 +++++
grub-core/kern/main.c | 11 ++++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 135586c..986871c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-03-01 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/kern/main.c (grub_set_prefix_and_root): Strip trailing
+ platform from firmware path.
+
2013-02-28 Vladimir Serbinenko <phcoder@gmail.com>
Enable linux16 on non-BIOS systems for i.a. memtest.
diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c
index 3262444..c43ac6b 100644
--- a/grub-core/kern/main.c
+++ b/grub-core/kern/main.c
@@ -168,7 +168,16 @@ grub_set_prefix_and_root (void)
else
grub_free (fwdevice);
if (fwpath && !path)
- path = fwpath;
+ {
+ grub_size_t len = grub_strlen (fwpath);
+ while (len > 1 && fwpath[len - 1] == '/')
+ fwpath[--len] = 0;
+ if (len >= sizeof (GRUB_TARGET_CPU "-" GRUB_PLATFORM) - 1
+ && grub_memcmp (fwpath + len - (sizeof (GRUB_TARGET_CPU "-" GRUB_PLATFORM) - 1), GRUB_TARGET_CPU "-" GRUB_PLATFORM,
+ sizeof (GRUB_TARGET_CPU "-" GRUB_PLATFORM) - 1) == 0)
+ fwpath[len - (sizeof (GRUB_TARGET_CPU "-" GRUB_PLATFORM) - 1)] = 0;
+ path = fwpath;
+ }
else
grub_free (fwpath);
if (device)
--
1.8.2.1