From 11712b6667225ef6fa6b64c1fe48ed5b501ad72e Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 24 Jun 2014 10:32:25 +0200 Subject: libfdisk: (dos) count fisrt usable LBA to total number of used sectors The check() function counts number of used sectors, but it counts only partitions. This is mistake, the area before the first partition is also "used" place (boot loaders or we have to align the first partition to disk I/O limits, etc). Signed-off-by: Karel Zak --- libfdisk/src/dos.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libfdisk/src/dos.c') diff --git a/libfdisk/src/dos.c b/libfdisk/src/dos.c index a8d4337d7..5453eb3d7 100644 --- a/libfdisk/src/dos.c +++ b/libfdisk/src/dos.c @@ -1281,6 +1281,9 @@ static int dos_verify_disklabel(struct fdisk_context *cxt) check(cxt, i + 1, p->eh, p->es, p->ec, last[i]); total += last[i] + 1 - first[i]; + if (i == 0) + total += get_abs_partition_start(pe) - 1; + for (j = 0; j < i; j++) { if ((first[i] >= first[j] && first[i] <= last[j]) || ((last[i] <= last[j] && last[i] >= first[j]))) { -- cgit v1.2.3-55-g7522