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

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


Commit-ID:  ed879e7b26cda15f191a2ef337a959be46601757
Gitweb:     http://syslinux.zytor.com/commit/ed879e7b26cda15f191a2ef337a959be46601757
Author:     Michal Soltys <soltys at ziu.info>
AuthorDate: Fri, 30 Jul 2010 08:46:07 +0200
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Fri, 30 Jul 2010 10:13:48 -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 48a83d2..a5f6401 100644
--- a/com32/modules/chain.c
+++ b/com32/modules/chain.c
@@ -624,8 +624,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;
 
@@ -869,7 +869,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 */



More information about the Syslinux-commits mailing list