diff options
author | Pierre-Alexandre Meyer <pierre@mouraf.org> | 2009-04-21 12:04:03 -0700 |
---|---|---|
committer | Pierre-Alexandre Meyer <pierre@mouraf.org> | 2009-04-21 12:04:03 -0700 |
commit | bb646b9842e85f1bbf51bb1bac1c72e3e763aa03 (patch) | |
tree | e4b7b913c97a3b8f9555d476a0a74b016f042e39 /com32/hdt | |
parent | 5681e04fe55a0907d2136223fecc7e85e6b1b876 (diff) | |
download | hdt-bb646b9842e85f1bbf51bb1bac1c72e3e763aa03.tar.gz hdt-bb646b9842e85f1bbf51bb1bac1c72e3e763aa03.tar.xz hdt-bb646b9842e85f1bbf51bb1bac1c72e3e763aa03.zip |
hdt: Do not modify offsets in the part_entry itself
Impact: fix bug
When printing extended partitions information, we need to adjust
the start lba. Do not modify it in the part_entry struct but just
print the adjusted one.
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
Diffstat (limited to 'com32/hdt')
-rw-r--r-- | com32/hdt/hdt-cli-disk.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/com32/hdt/hdt-cli-disk.c b/com32/hdt/hdt-cli-disk.c index 5a12f43a..8689a37a 100644 --- a/com32/hdt/hdt-cli-disk.c +++ b/com32/hdt/hdt-cli-disk.c @@ -62,19 +62,25 @@ static void show_partition_information(struct part_entry *ptab, int i, { char size[8]; char *parttype; - int error; + int error = 0; char *error_buffer; + int start; - /* Adjust offsets */ if (ptab_root) - ptab->start_lba += ptab_root->start_lba; + start = ptab->start_lba + ptab_root->start_lba; + else + start = ptab->start_lba; + + if (ptab->length > 0) + sectors_to_size(ptab->length, size); + else + memset(size, 0, sizeof size); - sectors_to_size(ptab->length, size); get_label(ptab->ostype, &parttype); more_printf(" %d %s %8d %8d %s %02X %s", i, (ptab->active_flag == 0x80) ? " x " : " ", - ptab->start_lba, - ptab->start_lba + ptab->length, + start, + start + ptab->length, size, ptab->ostype, parttype); |