]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: (sun) fix end sectors with +1 error
authorKarel Zak <kzak@redhat.com>
Fri, 1 Nov 2013 11:15:25 +0000 (12:15 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 1 Nov 2013 11:15:25 +0000 (12:15 +0100)
partx (or parted, etc.):

NR     START       END   SECTORS   SIZE NAME UUID
 1         0    410047    410048 200.2M
 2    410048  82329055  81919008  39.1G
 4  82329056 102807615  20478560   9.8G
 5 102807616 110999039   8191424   3.9G
 6 110999040 312580543 201581504  96.1G

and the same with fdisk:

     Device Flag    Start       End    Blocks   Id  System
/dev/loop0p1             0    410048    205024    1  Boot
/dev/loop0p2        410048  82329056  40959504   83  Linux native
/dev/loop0p3             0 312580544 156290272    5  Whole disk
/dev/loop0p4      82329056 102807616  10239280   83  Linux native
/dev/loop0p5     102807616 110999040   4095712   83  Linux native
/dev/loop0p6     110999040 312580544 100790752   8e  Linux LVM

Reported-by: Phillip Susi <psusi@ubuntu.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk/src/sun.c

index d890a32a42c85ad3d2ce72efc225a35c1e51c6d8..319d8cdd6d018a001a9b88d3e014a3f461170ad7 100644 (file)
@@ -736,7 +736,7 @@ static int sun_list_disklabel(struct fdisk_context *cxt)
                        tt_line_set_data(ln, 1, p);     /* flags */
                if (asprintf(&p, "%ju", (uintmax_t) fdisk_scround(cxt, start)) > 0)
                        tt_line_set_data(ln, 2, p);     /* start */
-               if (asprintf(&p, "%ju", (uintmax_t) fdisk_scround(cxt, start + len)) > 0)
+               if (asprintf(&p, "%ju", (uintmax_t) fdisk_scround(cxt, start + len - 1)) > 0)
                        tt_line_set_data(ln, 3, p);     /* end */
                if (asprintf(&p, "%lu%c",
                                (unsigned long) len / 2,