diff options
author | Karel Zak | 2014-04-22 14:54:44 +0200 |
---|---|---|
committer | Karel Zak | 2014-04-22 14:54:44 +0200 |
commit | 6c64adeeb6bf53dd376c24dfbd72c4e2f3ade420 (patch) | |
tree | 31152e8214fcf2181057edcb3ccadfd796a4a154 /libfdisk/src/dos.c | |
parent | Merge branch 'test-fdisk' of https://github.com/rudimeier/util-linux (diff) | |
download | kernel-qcow2-util-linux-6c64adeeb6bf53dd376c24dfbd72c4e2f3ade420.tar.gz kernel-qcow2-util-linux-6c64adeeb6bf53dd376c24dfbd72c4e2f3ade420.tar.xz kernel-qcow2-util-linux-6c64adeeb6bf53dd376c24dfbd72c4e2f3ade420.zip |
libfdisk: (mbr) fix logical chain termination
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/dos.c')
-rw-r--r-- | libfdisk/src/dos.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/libfdisk/src/dos.c b/libfdisk/src/dos.c index 645410cbd..d3bd01cd9 100644 --- a/libfdisk/src/dos.c +++ b/libfdisk/src/dos.c @@ -1703,6 +1703,7 @@ static int dos_get_partition(struct fdisk_context *cxt, size_t n, static void print_chain_of_logicals(struct fdisk_context *cxt) { size_t i; + struct fdisk_dos_label *l = self_label(cxt); fputc('\n', stdout); @@ -1710,12 +1711,16 @@ static void print_chain_of_logicals(struct fdisk_context *cxt) struct pte *pe = self_pte(cxt, i); printf("#%02zu EBR [%10ju], " - "data[start=%ju, size=%10ju], " - "link[start=%10ju, size=%10ju]\n", + "data[start=%10ju (%10ju), size=%10ju], " + "link[start=%10ju (%10ju), size=%10ju]\n", i, (uintmax_t) pe->offset, + /* data */ (uintmax_t) dos_partition_get_start(pe->pt_entry), + (uintmax_t) get_abs_partition_start(pe), (uintmax_t) dos_partition_get_size(pe->pt_entry), + /* link */ (uintmax_t) dos_partition_get_start(pe->ex_entry), + (uintmax_t) l->ext_offset + dos_partition_get_start(pe->ex_entry), (uintmax_t) dos_partition_get_size(pe->ex_entry)); } } @@ -1784,11 +1789,6 @@ again: sector_t noff = nxt->offset - l->ext_offset, ooff = dos_partition_get_start(cur->ex_entry); - if (i + 1 == cxt->label->nparts_max - 1) { - clear_partition(nxt->ex_entry); - partition_set_changed(cxt, i + 1, 1); - break; - } if (noff == ooff) continue; @@ -1799,6 +1799,12 @@ again: set_partition(cxt, i, 1, nxt->offset, get_abs_partition_end(nxt), MBR_DOS_EXTENDED_PARTITION); + + if (i + 1 == cxt->label->nparts_max - 1) { + clear_partition(nxt->ex_entry); + partition_set_changed(cxt, i + 1, 1); + } + } DBG(LABEL, print_chain_of_logicals(cxt)); } |