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

syslinux-bot for Michal Soltys soltys at ziu.info
Fri Jul 30 10:21:02 PDT 2010


Commit-ID:  8afab2175c3df81fdc532930585003c712a219f1
Gitweb:     http://syslinux.zytor.com/commit/8afab2175c3df81fdc532930585003c712a219f1
Author:     Michal Soltys <soltys at ziu.info>
AuthorDate: Fri, 30 Jul 2010 08:46:06 +0200
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Fri, 30 Jul 2010 10:14:24 -0700

chain.c: fix public index value in mbr and gpt iterators

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>
Signed-off-by: H. Peter Anvin <hpa at zytor.com>


---
 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



More information about the Syslinux-commits mailing list