[syslinux] [PATCH 2/4] chain.c: gpt's index/private.index mismatch fix, cosmetic iterator changes
Michal Soltys
soltys at ziu.info
Mon Jul 26 15:50:33 PDT 2010
1) public index in gpt iterator should not skip empty partitions, e.g.
if we have 1st and 3rd gpt entry used, we expect the numbers to be
1 and 3, not 1 and 2 (similary to how linux sees it e.g. /dev/sda1 and
/dev/sda3). It's analogous to index / mbr_index fix.
2) free(ebr_part); in mbr iterator was not reachable. ebr iterator
takes care of freeing itself and its parent.
3) in ebr iterator, error jump from "insane" partition error
can simply go to err_ebr.
Signed-off-by: Michal Soltys <soltys at ziu.info>
---
com32/modules/chain.c | 10 ++--------
1 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/com32/modules/chain.c b/com32/modules/chain.c
index 91db9f7..b5c1d8f 100644
--- a/com32/modules/chain.c
+++ b/com32/modules/chain.c
@@ -558,7 +558,7 @@ static struct disk_part_iter *next_ebr_part(struct disk_part_iter *part)
if (ebr_table[0].start_lba >= extended->start_lba + extended->length) {
dprintf("Insane logical partition!\n");
- goto err_insane;
+ goto err_ebr;
}
}
/* Success */
@@ -568,12 +568,7 @@ static struct disk_part_iter *next_ebr_part(struct disk_part_iter *part)
part->record = ebr_table;
return part;
-err_insane:
-
- free(part->block);
- part->block = NULL;
err_ebr:
-
out_finished:
free(part->private.ebr.parent->block);
free(part->private.ebr.parent);
@@ -629,7 +624,6 @@ static struct disk_part_iter *next_mbr_part(struct disk_part_iter *part)
part->record = table + part->private.mbr_index;
return part;
- free(ebr_part);
err_alloc:
free(part->block);
@@ -869,7 +863,7 @@ static struct disk_part_iter *next_gpt_part(struct disk_part_iter *part)
part->private.gpt.part_guid = &gpt_part->uid;
part->private.gpt.part_label = gpt_part->name;
/* Update our index */
- part->index++;
+ part->index = part->private.gpt.index + 1;
gpt_part_dump(gpt_part);
/* In a GPT scheme, we re-use the iterator */
--
1.6.3.1
More information about the Syslinux
mailing list