From b0e1e343d883a556378c31e9f29ac983e687778f Mon Sep 17 00:00:00 2001 From: "Andrey A. Chernov" Date: Tue, 14 Mar 2006 19:53:03 +0000 Subject: POSIXed strtoll() (and ours one too) can set errno to EINVAL, so check it first. Approved by: andre --- libc/stdlib/strtonum.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libc') diff --git a/libc/stdlib/strtonum.c b/libc/stdlib/strtonum.c index 0bf29c3..6dccd97 100644 --- a/libc/stdlib/strtonum.c +++ b/libc/stdlib/strtonum.c @@ -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; -- cgit v1.2.3-56-ge451