]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: (dos) Fix printing number of CHS sectors in check error message
authorPali Rohár <pali.rohar@gmail.com>
Tue, 6 Jul 2021 11:51:22 +0000 (13:51 +0200)
committerPali Rohár <pali.rohar@gmail.com>
Thu, 15 Jul 2021 19:49:30 +0000 (21:49 +0200)
Number of CHS sectors (indexed from zero) is stored in variable 'real_s'.
In variable 's' is stored in high 2 bits number of CHS cylinders.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
libfdisk/src/dos.c

index 39dd9ef43c3ee6c48ae6c3ba24ba14ca2692c817..aeb819f1a1fc2eeddb882dcf323f5c67acc4c990 100644 (file)
@@ -1516,7 +1516,7 @@ static void check(struct fdisk_context *cxt, size_t n,
                                   "maximum %d"), n, h + 1, cxt->geom.heads);
        if (real_s >= cxt->geom.sectors)
                fdisk_warnx(cxt, _("Partition %zu: sector %d greater than "
-                                  "maximum %ju"), n, s,
+                                  "maximum %ju"), n, real_s + 1,
                                (uintmax_t) cxt->geom.sectors);
        if (real_c >= cxt->geom.cylinders)
                fdisk_warnx(cxt, _("Partition %zu: cylinder %d greater than "