]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: (dos) count fisrt usable LBA to total number of used sectors
authorKarel Zak <kzak@redhat.com>
Tue, 24 Jun 2014 08:32:25 +0000 (10:32 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 24 Jun 2014 08:32:25 +0000 (10:32 +0200)
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 <kzak@redhat.com>
libfdisk/src/dos.c

index a8d4337d7904758c998b7db9c3ba74fc3b99a8c2..5453eb3d763ba0f2225ac03423919cd58ce00957 100644 (file)
@@ -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]))) {