[syslinux] [PATCH 1/1, disklib] chain.c: fix public index value in mbr and gpt iterators

Michal Soltys soltys at ziu.info
Thu Jul 29 23:46:06 PDT 2010


mbr and gpt iterators skip empty / non-data partitions properly, but don't
update publicly visible index. With this patch, such partitions are counted as
well.

Signed-off-by: Michal Soltys <soltys at ziu.info>
---
 com32/modules/chain.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/com32/modules/chain.c b/com32/modules/chain.c
index 5078ed3..60e3abc 100644
--- a/com32/modules/chain.c
+++ b/com32/modules/chain.c
@@ -335,8 +335,8 @@ static struct disk_part_iter *next_mbr_part(struct disk_part_iter *part)
 
     /* Update parameters to reflect this new partition.  Re-use iterator */
     part->lba_data = table[part->private.mbr_index].start_lba;
-    dprintf("Partition %d primary lba %u\n", part->index, part->lba_data);
-    part->index++;
+    dprintf("Partition %d primary lba %u\n", part->private.mbr_index, part->lba_data);
+    part->index = part->private.mbr_index + 1;
     part->record = table + part->private.mbr_index;
     return part;
 
@@ -369,7 +369,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;
 #ifdef DEBUG
     disk_gpt_part_dump(gpt_part);
 #endif
-- 
1.6.3.1




More information about the Syslinux mailing list