* disk/mdraid_linux.c (struct grub_raid_super_1x): Remove

__attribute__ ((packed)), leaving a comment.
(grub_mdraid_detect): Split out 0.9 and 1.x detection to ...
(grub_mdraid_detect_09): ... here and ...
(grub_mdraid_detect_1x): ... here.
* disk/raid.c (insert_array): Check for grub_xasprintf returning
NULL.
This commit is contained in:
Colin Watson 2010-07-19 11:35:16 +01:00
parent 1c785436da
commit 68ac8c8d15
3 changed files with 165 additions and 126 deletions

View file

@ -564,13 +564,31 @@ insert_array (grub_disk_t disk, struct grub_raid_array *new_array,
/* mdraid 1.x superblocks have only a name stored not a number.
Use it directly as GRUB device. */
if (! array->name)
array->name = grub_xasprintf ("md%d", array->number);
{
array->name = grub_xasprintf ("md%d", array->number);
if (! array->name)
{
grub_free (array->uuid);
grub_free (array);
return grub_errno;
}
}
else
{
/* Strip off the homehost if present. */
char *colon = grub_strchr (array->name, ':');
char *new_name = grub_xasprintf ("md/%s",
colon ? colon + 1 : array->name);
if (! new_name)
{
grub_free (array->uuid);
grub_free (array);
return grub_errno;
}
grub_free (array->name);
array->name = new_name;
}