When using the -a and -s flag, gpart resize fails to set the requested
size on a given partition when there is a partition following it and when the
resize operation is growing the size of the partition. It sets it to the maximum
available space, regardless of the size requested.
This patch calculates the maximum size that can be used, either using the
start of the next partition or the last sector of the geom as the upper limit,
I've removed the offset calculation. Looking at the gpart add code, the
lower and upper boundary of a partition is calculated with the offset included
and the offset is removed after the size has been calculated. As I understand
it, when resizing, the size will be the same regardless of the offset.