]> err.no Git - util-linux/commitdiff
sfdisk: allow partitioning drives of over 2^31 sectors.
authorKunihiko IMAI <kimai@iodata.jp>
Mon, 20 Aug 2007 12:12:53 +0000 (06:12 -0600)
committerKarel Zak <kzak@redhat.com>
Wed, 5 Dec 2007 10:44:21 +0000 (11:44 +0100)
sfdisk would incorrectly complain that there was no room when partitioning
a drive over 2^31 sectors in size.

Signed-off-by: LaMont Jones <lamont@mmjgroup.com>
fdisk/sfdisk.c

index 29f66cc6baf815c02e063b2d8e1cf9ac8e26c810..1241f6622b6d4b41e9e5fdcf9c937c7804070480 100644 (file)
@@ -1925,11 +1925,12 @@ compute_start_sect(struct part_desc *p, struct part_desc *ep) {
       delta = 0;
 
     if (delta < 0) {
+       unsigned long old_size = p->size;
        p->start -= delta;
        p->size += delta;
        if (is_extended(p->p.sys_type) && boxes == ONESECTOR)
          p->size = inc;
-       else if ((int)(p->size) <= 0) {
+       else if (old_size <= -delta) {
            warn(_("no room for partition descriptor\n"));
            return 0;
        }