Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Nov 2002 22:07:50 -0800 (PST)
From:      Nate Lawson <nate@root.org>
To:        Tim Robbins <tjr@FreeBSD.ORG>
Cc:        Julian Elischer <julian@elischer.org>, FreeBSD current users <current@FreeBSD.ORG>
Subject:   Re: Sign fixes for disklabel(8)
Message-ID:  <Pine.BSF.4.21.0211152205130.48493-100000@root.org>
In-Reply-To: <20021116131842.A92191@dilbert.robbins.dropbear.id.au>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0211152205130.48493-100000>