Michal Soltys
2010-Jul-22 13:30 UTC
[syslinux] [PATCH] chain.c: mismatch between index and mbr_index in mbr iterator
When primary partitions are iterated, non-data partitions should also be counted. For example, if we have data partitions #1, #2, #4 and empty partition #3, then chain.c32 hd0 4 would fail (as cur_part->index would be 3 for the 4th partition, and whichpart would be 4). This patch fixes this. Signed-off-by: Michal Soltys <soltys at ziu.info> --- com32/modules/chain.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/com32/modules/chain.c b/com32/modules/chain.c index 48a83d2..91db9f7 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; -- 1.6.3.1