]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2008-10-29 Guillem Jover <guillem.jover@nokia.com>
authorrobertmh <robertmh@localhost>
Wed, 29 Oct 2008 19:24:11 +0000 (19:24 +0000)
committerrobertmh <robertmh@localhost>
Wed, 29 Oct 2008 19:24:11 +0000 (19:24 +0000)
        * 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.

ChangeLog
disk/lvm.c

index 98aefe4345ecb13d784d27e85ff31401991dfb81..430a37b78e43544d58d7c6e270a760d6b44d0e3a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * disk/lvm.c (grub_lvm_scan_device): Fix possible NULL value handling
index 0b35aa9ad981989db2e829344de55b0342c0da88..6ebde636ff408f9654564e8062410c518035cb5b 100644 (file)
@@ -356,8 +356,6 @@ grub_lvm_scan_device (const char *name)
 
       vg->lvs = NULL;
       vg->pvs = NULL;
-      vg->next = vg_list;
-      vg_list = vg;
 
       p = grub_strstr (p, "physical_volumes {");
       if (p)
@@ -395,14 +393,15 @@ grub_lvm_scan_device (const char *name)
              pv->start = grub_lvm_getvalue (&p, "pe_start = ");
              if (p == NULL)
                goto pvs_fail;
-             pv->disk = NULL;
-             pv->next = vg->pvs;
-             vg->pvs = pv;
              
              p = grub_strchr (p, '}');
              if (p == NULL)
                goto pvs_fail;
              p++;
+
+             pv->disk = NULL;
+             pv->next = vg->pvs;
+             vg->pvs = pv;
              
              continue;
            pvs_fail:
@@ -531,16 +530,16 @@ grub_lvm_scan_device (const char *name)
                  goto fail4;
                }
 
-             lv->number = lv_count++;
-             lv->vg = vg;
-             lv->next = vg->lvs;
-             vg->lvs = lv;
-             
              p = grub_strchr (p, '}');
              if (p == NULL)
                goto lvs_fail;
              p += 3;
              
+             lv->number = lv_count++;
+             lv->vg = vg;
+             lv->next = vg->lvs;
+             vg->lvs = lv;
+
              continue;
            lvs_fail:
              grub_free (lv->name);
@@ -548,6 +547,9 @@ grub_lvm_scan_device (const char *name)
              goto fail4;
            }
        }
+
+       vg->next = vg_list;
+       vg_list = vg;
     }
   else
     {