summaryrefslogtreecommitdiffstats
path: root/libfdisk
diff options
context:
space:
mode:
authorKarel Zak2018-09-17 11:58:50 +0200
committerKarel Zak2018-09-17 11:58:50 +0200
commit2f35c1ead621f42f32f7777232568cb03185b473 (patch)
treed5a9bcf8d5efe33d706196f0f8aec518eefa6d6b /libfdisk
parentlsblk: encapsulate stat() usage (diff)
downloadkernel-qcow2-util-linux-2f35c1ead621f42f32f7777232568cb03185b473.tar.gz
kernel-qcow2-util-linux-2f35c1ead621f42f32f7777232568cb03185b473.tar.xz
kernel-qcow2-util-linux-2f35c1ead621f42f32f7777232568cb03185b473.zip
libfdisk: count gaps to possible size when resize
The current code counts only partition sizes when it counts possible space, but we have gaps between the partitions. It seems better to count all based on offsets rather than sizes. Addresses: https://github.com/karelzak/util-linux/issues/693 Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk')
-rw-r--r--libfdisk/src/partition.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libfdisk/src/partition.c b/libfdisk/src/partition.c
index a790dc9c9..ebcf6bf5c 100644
--- a/libfdisk/src/partition.c
+++ b/libfdisk/src/partition.c
@@ -1113,7 +1113,7 @@ static int resize_get_last_possible(
break;
} else {
last = pa;
- *maxsz += pa->size;
+ *maxsz = pa->size - (start - pa->start);
DBG(TAB, ul_debugobj(tb, " new max=%ju (last updated)", (uintmax_t) *maxsz));
}
}