From 1c715b5afd125e5224df638986bf37fde29e0bcc Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 5 Jun 2012 11:31:10 +0200 Subject: [PATCH] * util/grub-probe.c (escape_of_path): Don't add ieee1275/. (probe): Add ieee1275 to OFW devices. --- ChangeLog | 5 +++++ util/grub-probe.c | 19 ++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1e3e625ad..f35170d68 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-06-05 Vladimir Serbinenko + + * util/grub-probe.c (escape_of_path): Don't add ieee1275/. + (probe): Add ieee1275 to OFW devices. + 2012-06-04 Vladimir Serbinenko * util/ieee1275/ofpath.c (of_path_of_scsi): Fix wrong format specifier. diff --git a/util/grub-probe.c b/util/grub-probe.c index 8beb1bc60..4db259bd2 100644 --- a/util/grub-probe.c +++ b/util/grub-probe.c @@ -157,11 +157,10 @@ escape_of_path (const char *orig_path) if (!strchr (orig_path, ',')) return (char *) xstrdup (orig_path); - new_path = xmalloc (strlen (orig_path) * 2 + sizeof ("ieee1275/")); + new_path = xmalloc (strlen (orig_path) * 2 + 1); p = orig_path; - grub_strcpy (new_path, "ieee1275/"); - d = new_path + sizeof ("ieee1275/") - 1; + d = new_path; while ((c = *p++) != '\0') { if (c == ',') @@ -499,9 +498,14 @@ probe (const char *path, char **device_names, char delim) if (ofpath) { + char *tmp = xmalloc (strlen (ofpath) + sizeof ("ieee1275/")); + char *p; + p = stpcpy (tmp, "ieee1275/"); + strcpy (p, ofpath); printf ("--hint-ieee1275='"); - print_full_name (ofpath, dev); + print_full_name (tmp, dev); printf ("' "); + free (tmp); } biosname = guess_bios_drive (*curdev); @@ -611,7 +615,12 @@ probe (const char *path, char **device_names, char delim) if (ofpath) { - print_full_name (ofpath, dev); + char *tmp = xmalloc (strlen (ofpath) + sizeof ("ieee1275/")); + char *p; + p = stpcpy (tmp, "ieee1275/"); + strcpy (p, ofpath); + print_full_name (tmp, dev); + free (tmp); putchar (delim); }