dcavalca / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone

Blame SOURCES/0048-libfdisk-count-gaps-to-possible-size-when-resize.patch

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