From 7768950fe38f446c3f8b6ac6d3d7707990b0f50e Mon Sep 17 00:00:00 2001 From: "Andrey A. Chernov" Date: Tue, 14 Mar 2006 19:53:03 +0000 Subject: [PATCH] POSIXed strtoll() (and ours one too) can set errno to EINVAL, so check it first. Approved by: andre --- lib/libc/stdlib/strtonum.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libc/stdlib/strtonum.c b/lib/libc/stdlib/strtonum.c index 0bf29c37aaad..6dccd973606b 100644 --- a/lib/libc/stdlib/strtonum.c +++ b/lib/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;