]> git.cameronkatri.com Git - pw-darwin.git/commitdiff
POSIXed strtoll() (and ours one too) can set errno to EINVAL, so check
authorAndrey A. Chernov <ache@FreeBSD.org>
Tue, 14 Mar 2006 19:53:03 +0000 (19:53 +0000)
committerAndrey A. Chernov <ache@FreeBSD.org>
Tue, 14 Mar 2006 19:53:03 +0000 (19:53 +0000)
it first.

Approved by:    andre

libc/stdlib/strtonum.c

index 0bf29c37aaad7a6465c86e8769c65f46f1b9b213..6dccd973606b2dbbc31276e5e767cf07be270854 100644 (file)
@@ -51,7 +51,7 @@ strtonum(const char *numstr, long long minval, long long maxval,
                error = INVALID;
        else {
                ll = strtoll(numstr, &ep, 10);
-               if (numstr == ep || *ep != '\0')
+               if (errno == EINVAL || numstr == ep || *ep != '\0')
                        error = INVALID;
                else if ((ll == LLONG_MIN && errno == ERANGE) || ll < minval)
                        error = TOOSMALL;