cvs commit: src/lib/libc/stdlib Makefile.inc Symbol.map strtonum.3 strtonum.c src/include stdlib.h

Andre Oppermann andre at freebsd.org
Tue Mar 14 17:49:14 UTC 2006


Andrey Chernov wrote:
> 
> On Tue, Mar 14, 2006 at 04:57:30PM +0000, Andre Oppermann wrote:
> > andre       2006-03-14 16:57:30 UTC
> >
> >   FreeBSD src repository
> >
> >   Modified files:
> >     lib/libc/stdlib      Makefile.inc Symbol.map
> >     include              stdlib.h
> >   Added files:
> >     lib/libc/stdlib      strtonum.3 strtonum.c
> >   Log:
> >   Import of OpenBSD's strtonum(3) which is a nicer version of strtoll(3)
> >   providing proper error checking and other improvements.
> 
> Error checking isn't so proper as said.
> 
> if (numstr == ep || *ep != '\0')
> 
> must be
> 
> if (numstr == ep || *ep != '\0' || errno == EINVAL)

>From my reading there is no case of EINVAL which would not be catched
by (numstr == ep || *ep != '\0').  However OpenBSD's strtoll(3) never
returns EINVAL in the first place.

> I'll commit this, if no objections.

I agree that this extra check makes things more clear and will catch
errors properly should our strtoll(3) ever be changed.  Please commit.

-- 
Andre


More information about the cvs-src mailing list