* grub-core/kern/ieee1275/openfw.c (grub_ieee1275_encode_devname):
Escape commas.
This commit is contained in:
parent
918a25179c
commit
3123054474
2 changed files with 29 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2012-06-20 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/kern/ieee1275/openfw.c (grub_ieee1275_encode_devname):
|
||||||
|
Escape commas.
|
||||||
|
|
||||||
2012-06-20 Vladimir Serbinenko <phcoder@gmail.com>
|
2012-06-20 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
Restructure FAT driver to avoid hook in label reading as it hits a
|
Restructure FAT driver to avoid hook in label reading as it hits a
|
||||||
|
|
|
@ -436,21 +436,42 @@ char *
|
||||||
grub_ieee1275_encode_devname (const char *path)
|
grub_ieee1275_encode_devname (const char *path)
|
||||||
{
|
{
|
||||||
char *device = grub_ieee1275_get_devname (path);
|
char *device = grub_ieee1275_get_devname (path);
|
||||||
char *partition = grub_ieee1275_parse_args (path, GRUB_PARSE_PARTITION);
|
char *partition;
|
||||||
char *encoding;
|
char *encoding;
|
||||||
|
char *optr;
|
||||||
|
const char *iptr;
|
||||||
|
|
||||||
|
encoding = grub_malloc (sizeof ("ieee1275/") + 2 * grub_strlen (device)
|
||||||
|
+ sizeof (",XXXXXXXXXXXX"));
|
||||||
|
if (!encoding)
|
||||||
|
{
|
||||||
|
grub_free (device);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
partition = grub_ieee1275_parse_args (path, GRUB_PARSE_PARTITION);
|
||||||
|
|
||||||
|
optr = grub_stpcpy (encoding, "ieee1275/");
|
||||||
|
for (iptr = device; *iptr; )
|
||||||
|
{
|
||||||
|
if (*iptr == ',')
|
||||||
|
*optr++ ='\\';
|
||||||
|
*optr++ = *iptr++;
|
||||||
|
}
|
||||||
if (partition && partition[0])
|
if (partition && partition[0])
|
||||||
{
|
{
|
||||||
unsigned int partno = grub_strtoul (partition, 0, 0);
|
unsigned int partno = grub_strtoul (partition, 0, 0);
|
||||||
|
|
||||||
|
*optr++ = ',';
|
||||||
|
|
||||||
if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_0_BASED_PARTITIONS))
|
if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_0_BASED_PARTITIONS))
|
||||||
/* GRUB partition 1 is OF partition 0. */
|
/* GRUB partition 1 is OF partition 0. */
|
||||||
partno++;
|
partno++;
|
||||||
|
|
||||||
encoding = grub_xasprintf ("ieee1275/%s,%d", device, partno);
|
grub_snprintf (optr, sizeof ("XXXXXXXXXXXX"), "%d", partno);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
encoding = grub_xasprintf ("ieee1275/%s", device);
|
*optr = '\0';
|
||||||
|
|
||||||
grub_free (partition);
|
grub_free (partition);
|
||||||
grub_free (device);
|
grub_free (device);
|
||||||
|
|
Loading…
Reference in a new issue