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>
This commit is contained in:
Karel Zak 2018-09-17 11:58:50 +02:00
parent 652cb1cd26
commit 2f35c1ead6
1 changed files with 1 additions and 1 deletions

View File

@ -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));
}
}