diff options
author | Karel Zak | 2014-06-24 10:32:25 +0200 |
---|---|---|
committer | Karel Zak | 2014-06-24 10:32:25 +0200 |
commit | 11712b6667225ef6fa6b64c1fe48ed5b501ad72e (patch) | |
tree | 5718df3b57a26affc75f8836b3a007ff61ef6e84 /libfdisk/src/dos.c | |
parent | libfdisk: (dos) use check() for dos-comaptible mode only (diff) | |
download | kernel-qcow2-util-linux-11712b6667225ef6fa6b64c1fe48ed5b501ad72e.tar.gz kernel-qcow2-util-linux-11712b6667225ef6fa6b64c1fe48ed5b501ad72e.tar.xz kernel-qcow2-util-linux-11712b6667225ef6fa6b64c1fe48ed5b501ad72e.zip |
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 <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/dos.c')
-rw-r--r-- | libfdisk/src/dos.c | 3 |
1 files changed, 3 insertions, 0 deletions
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]))) { |