aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Soltys <soltys@ziu.info>2010-07-30 08:46:07 +0200
committerH. Peter Anvin <hpa@zytor.com>2010-07-30 10:13:48 -0700
commited879e7b26cda15f191a2ef337a959be46601757 (patch)
treed86f829fdb2d215f4e2b8fb291acd8aac76708e9
parente841d6983b3f161a0a8566e8a8b3b18d83e845cf (diff)
downloadhdt-pierre-ed879e7b26cda15f191a2ef337a959be46601757.tar.gz
hdt-pierre-ed879e7b26cda15f191a2ef337a959be46601757.tar.xz
hdt-pierre-ed879e7b26cda15f191a2ef337a959be46601757.zip
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@ziu.info> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--com32/modules/chain.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/com32/modules/chain.c b/com32/modules/chain.c
index 48a83d2a..a5f6401c 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 */