From owner-freebsd-current Fri Nov 15 22: 7:50 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 DE5AC37B401 for ; Fri, 15 Nov 2002 22:07:48 -0800 (PST) Received: from rootlabs.com (root.org [67.118.192.226]) by mx1.FreeBSD.org (Postfix) with SMTP id 2CE1443E75 for ; Fri, 15 Nov 2002 22:07:48 -0800 (PST) (envelope-from nate@rootlabs.com) Received: (qmail 48512 invoked by uid 1000); 16 Nov 2002 06:07:50 -0000 Date: Fri, 15 Nov 2002 22:07:50 -0800 (PST) From: Nate Lawson To: Tim Robbins Cc: Julian Elischer , FreeBSD current users Subject: Re: Sign fixes for disklabel(8) In-Reply-To: <20021116131842.A92191@dilbert.robbins.dropbear.id.au> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 Sat, 16 Nov 2002, Tim Robbins wrote: > 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) > [...] > > - 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. In the overflow case, strtoul returns ULONG_MAX. Or if you're interested in catching invalid characters, use endptr. -Nate To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message