* grub-core/kern/main.c (grub_set_prefix_and_root): Strip trailing

platform from firmware path.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2013-03-01 10:35:51 +01:00
parent 0789b67232
commit be174e5ef3
2 changed files with 15 additions and 1 deletions

View file

@ -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> 2013-02-28 Vladimir Serbinenko <phcoder@gmail.com>
Enable linux16 on non-BIOS systems for i.a. memtest. Enable linux16 on non-BIOS systems for i.a. memtest.

View file

@ -168,7 +168,16 @@ grub_set_prefix_and_root (void)
else else
grub_free (fwdevice); grub_free (fwdevice);
if (fwpath && !path) if (fwpath && !path)
{
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; path = fwpath;
}
else else
grub_free (fwpath); grub_free (fwpath);
if (device) if (device)