From owner-freebsd-current Fri Nov 15 18:18:59 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5B27037B401 for ; Fri, 15 Nov 2002 18:18:57 -0800 (PST) Received: from smtp02.iprimus.net.au (smtp02.iprimus.net.au [210.50.76.70]) by mx1.FreeBSD.org (Postfix) with ESMTP id B7B1F43E3B for ; Fri, 15 Nov 2002 18:18:55 -0800 (PST) (envelope-from tim@robbins.dropbear.id.au) Received: from dilbert.robbins.dropbear.id.au ([210.50.203.155]) by smtp02.iprimus.net.au with Microsoft SMTPSVC(5.0.2195.5600); Sat, 16 Nov 2002 13:18:46 +1100 Received: from dilbert.robbins.dropbear.id.au (vx0fccdbdepxfvz8@localhost [127.0.0.1]) by dilbert.robbins.dropbear.id.au (8.12.6/8.12.6) with ESMTP id gAG2Ihbo092852; Sat, 16 Nov 2002 13:18:43 +1100 (EST) (envelope-from tim@dilbert.robbins.dropbear.id.au) Received: (from tim@localhost) by dilbert.robbins.dropbear.id.au (8.12.6/8.12.6/Submit) id gAG2Igbm092851; Sat, 16 Nov 2002 13:18:42 +1100 (EST) (envelope-from tim) Date: Sat, 16 Nov 2002 13:18:42 +1100 From: Tim Robbins To: Julian Elischer Cc: FreeBSD current users Subject: Re: Sign fixes for disklabel(8) Message-ID: <20021116131842.A92191@dilbert.robbins.dropbear.id.au> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: ; from julian@elischer.org on Fri, Nov 15, 2002 at 03:59:25PM -0800 X-OriginalArrivalTime: 16 Nov 2002 02:18:47.0417 (UTC) FILETIME=[7EB1BE90:01C28D16] Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri, Nov 15, 2002 at 03:59:25PM -0800, Julian Elischer wrote: > Here are the diffs to allow disklabel to correctly create partitions > > 1TB (up to 2TB is useful with UFS2) pending a different partitionning > scheme. It also allows you to correctly make smaller partitions beyond > 1TB which is nice if you don't want to waste 800GB on an array :-) > > > permission to commit please? > (pending comments by others) > > (also the sysinstall changes posted before) > (also the bluetooth code) [...] > - int v, lineno = 0, errors = 0; > + unsigned int v; > + int lineno = 0, errors = 0; > int i; [...] > - v = atoi(tp); > + v = strtoul(tp, NULL, 0); > if ((unsigned)v >= DKMAXTYPES) > fprintf(stderr, "line %d:%s %d\n", lineno, > "Warning, unknown disk type", v); This cast is redundant since v is already unsigned. The fprintf() format string needs to use %u instead of %d. Use 10 as the base argument to stroul(), not 0 otherwise numbers with leading zeros will be interpreted as octal. [...] > - v = atoi(tp); > + v = strtoul(tp, NULL, 0); > if (v <= 0 || (v % DEV_BSIZE) != 0) { > fprintf(stderr, > "line %d: %s: bad sector size\n", Should be == 0, not <= 0 since v is unsigned. [...] > - v = atoi(tp); > + v = strtoul(tp, NULL, 0); > if (v < 0) { > fprintf(stderr, "line %d: %s: bad %s\n", > lineno, tp, cp); v < 0 is impossible. Tim To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message