From: Kunihiko IMAI Date: Mon, 20 Aug 2007 12:12:53 +0000 (-0600) Subject: sfdisk: allow partitioning drives of over 2^31 sectors. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5119dec449a8d7c07bf01947e957b862035e1260;p=util-linux sfdisk: allow partitioning drives of over 2^31 sectors. sfdisk would incorrectly complain that there was no room when partitioning a drive over 2^31 sectors in size. Signed-off-by: LaMont Jones --- diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c index 99e165ef..a3b66174 100644 --- a/fdisk/sfdisk.c +++ b/fdisk/sfdisk.c @@ -1927,11 +1927,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; }