From ca74c50c0bf5be773f645234daf22e740b844889 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 23 Dec 2011 18:46:06 +0100 Subject: [PATCH] merge mainline into hints --- grub-core/disk/ieee1275/ofdisk.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c index 2cd43d80a..b4a8d969c 100644 --- a/grub-core/disk/ieee1275/ofdisk.c +++ b/grub-core/disk/ieee1275/ofdisk.c @@ -198,8 +198,14 @@ grub_ofdisk_iterate (int (*hook) (const char *name), if (grub_strncmp (ent->shortest, "cdrom", 5) == 0) continue; - if (hook (ent->shortest)) - return 1; + { + char buffer[sizeof ("ieee1275/") + grub_strlen (env->shortest)]; + char *ptr; + ptr = grub_stpcpy (buffer, "ieee1275/"); + grub_strcpy (ptr, env->shortest); + if (hook (buffer)) + return 1; + } } } return 0; @@ -241,7 +247,10 @@ grub_ofdisk_open (const char *name, grub_disk_t disk) char prop[64]; grub_ssize_t actual; - devpath = compute_dev_path (name); + if (grub_strncmp (devpath, "ieee1275/", sizeof ("ieee1275/") - 1) != 0) + return grub_error (GRUB_ERR_UNKNOWN_DEVICE, + "not IEEE1275 device"); + devpath = compute_dev_path (name + sizeof ("ieee1275/") - 1); if (! devpath) return grub_errno;