439b44
From b3c5c1f39db58b057bb581f1d3bebcbeedeee1cb Mon Sep 17 00:00:00 2001
439b44
From: Karel Zak <kzak@redhat.com>
439b44
Date: Mon, 17 Sep 2018 11:58:50 +0200
439b44
Subject: [PATCH 48/55] libfdisk: count gaps to possible size when resize
439b44
439b44
The current code counts only partition sizes when it counts possible
439b44
space, but we have gaps between the partitions. It seems better to
439b44
count all based on offsets rather than sizes.
439b44
439b44
Addresses: https://github.com/karelzak/util-linux/issues/693
439b44
Upstream: http://github.com/karelzak/util-linux/commit/2f35c1ead621f42f32f7777232568cb03185b473
439b44
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1900498
439b44
Signed-off-by: Karel Zak <kzak@redhat.com>
439b44
---
439b44
 libfdisk/src/partition.c | 2 +-
439b44
 1 file changed, 1 insertion(+), 1 deletion(-)
439b44
439b44
diff --git a/libfdisk/src/partition.c b/libfdisk/src/partition.c
439b44
index a790dc9c9..ebcf6bf5c 100644
439b44
--- a/libfdisk/src/partition.c
439b44
+++ b/libfdisk/src/partition.c
439b44
@@ -1113,7 +1113,7 @@ static int resize_get_last_possible(
439b44
 			break;
439b44
 		} else {
439b44
 			last = pa;
439b44
-			*maxsz += pa->size;
439b44
+			*maxsz = pa->size - (start - pa->start);
439b44
 			DBG(TAB, ul_debugobj(tb, "  new max=%ju (last updated)", (uintmax_t) *maxsz));
439b44
 		}
439b44
 	}
439b44
-- 
439b44
2.29.2
439b44