=== modified file 'disk/ieee1275/ofdisk.c' --- disk/ieee1275/ofdisk.c 2010-07-29 06:04:55 +0000 +++ disk/ieee1275/ofdisk.c 2010-07-29 17:00:01 +0000 @@ -72,6 +72,39 @@ return p; } +static char * +escape_of_path (const char *orig_path) +{ + char *new_path, *d, c; + const char *p; + int i; + + if (!grub_strchr (orig_path, ',')) + return (char *) orig_path; + + new_path = grub_malloc (grub_strlen (orig_path) + 32); + + p = orig_path; + d = new_path; + i = 0; + while ((c = *p++) != '\0') + { + if (c == ',') + { + if (++i == 32) + { + /* oops, too many commas */ + break; + } + *d++ = '\\'; + } + *d++ = c; + } + + return new_path; +} + + static int grub_ofdisk_iterate (int (*hook) (const char *name)) { @@ -114,8 +147,11 @@ if (! grub_strcmp (alias->type, "block") && grub_strncmp (alias->name, "cdrom", 5)) { + char *name_path = use_path ? escape_of_path(alias->path) : alias->name; disks_found++; - ret = hook (use_path ? alias->path : alias->name); + ret = hook (name_path); + if (use_path && name_path != alias->path) + grub_free(name_path); } return ret; }