2008-10-29 Guillem Jover <guillem.jover@nokia.com>
* disk/lvm.c (grub_lvm_scan_device): Fix error recovery by delaying the addition of objects until the code is not going to be able to fail.
This commit is contained in:
parent
b727944702
commit
de4fa71c6c
2 changed files with 17 additions and 10 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2008-10-29 Guillem Jover <guillem.jover@nokia.com>
|
||||||
|
|
||||||
|
* disk/lvm.c (grub_lvm_scan_device): Fix error recovery by delaying the
|
||||||
|
addition of objects until the code is not going to be able to fail.
|
||||||
|
|
||||||
2008-10-29 Guillem Jover <guillem.jover@nokia.com>
|
2008-10-29 Guillem Jover <guillem.jover@nokia.com>
|
||||||
|
|
||||||
* disk/lvm.c (grub_lvm_scan_device): Fix possible NULL value handling
|
* disk/lvm.c (grub_lvm_scan_device): Fix possible NULL value handling
|
||||||
|
|
22
disk/lvm.c
22
disk/lvm.c
|
@ -356,8 +356,6 @@ grub_lvm_scan_device (const char *name)
|
||||||
|
|
||||||
vg->lvs = NULL;
|
vg->lvs = NULL;
|
||||||
vg->pvs = NULL;
|
vg->pvs = NULL;
|
||||||
vg->next = vg_list;
|
|
||||||
vg_list = vg;
|
|
||||||
|
|
||||||
p = grub_strstr (p, "physical_volumes {");
|
p = grub_strstr (p, "physical_volumes {");
|
||||||
if (p)
|
if (p)
|
||||||
|
@ -395,14 +393,15 @@ grub_lvm_scan_device (const char *name)
|
||||||
pv->start = grub_lvm_getvalue (&p, "pe_start = ");
|
pv->start = grub_lvm_getvalue (&p, "pe_start = ");
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
goto pvs_fail;
|
goto pvs_fail;
|
||||||
pv->disk = NULL;
|
|
||||||
pv->next = vg->pvs;
|
|
||||||
vg->pvs = pv;
|
|
||||||
|
|
||||||
p = grub_strchr (p, '}');
|
p = grub_strchr (p, '}');
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
goto pvs_fail;
|
goto pvs_fail;
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
|
pv->disk = NULL;
|
||||||
|
pv->next = vg->pvs;
|
||||||
|
vg->pvs = pv;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
pvs_fail:
|
pvs_fail:
|
||||||
|
@ -531,16 +530,16 @@ grub_lvm_scan_device (const char *name)
|
||||||
goto fail4;
|
goto fail4;
|
||||||
}
|
}
|
||||||
|
|
||||||
lv->number = lv_count++;
|
|
||||||
lv->vg = vg;
|
|
||||||
lv->next = vg->lvs;
|
|
||||||
vg->lvs = lv;
|
|
||||||
|
|
||||||
p = grub_strchr (p, '}');
|
p = grub_strchr (p, '}');
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
goto lvs_fail;
|
goto lvs_fail;
|
||||||
p += 3;
|
p += 3;
|
||||||
|
|
||||||
|
lv->number = lv_count++;
|
||||||
|
lv->vg = vg;
|
||||||
|
lv->next = vg->lvs;
|
||||||
|
vg->lvs = lv;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
lvs_fail:
|
lvs_fail:
|
||||||
grub_free (lv->name);
|
grub_free (lv->name);
|
||||||
|
@ -548,6 +547,9 @@ grub_lvm_scan_device (const char *name)
|
||||||
goto fail4;
|
goto fail4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vg->next = vg_list;
|
||||||
|
vg_list = vg;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue