diff options
author | ache <ache@FreeBSD.org> | 2006-03-14 19:53:03 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2006-03-14 19:53:03 +0000 |
commit | 93d3ecbce22e999d50d877edafb0ec67dde7e5f8 (patch) | |
tree | 7ada91025d40abcd020e27a5b87c842cb2540fc2 | |
parent | 476d18667583679bdf1230213949d32fb7c85943 (diff) | |
download | FreeBSD-src-93d3ecbce22e999d50d877edafb0ec67dde7e5f8.zip FreeBSD-src-93d3ecbce22e999d50d877edafb0ec67dde7e5f8.tar.gz |
POSIXed strtoll() (and ours one too) can set errno to EINVAL, so check
it first.
Approved by: andre
-rw-r--r-- | lib/libc/stdlib/strtonum.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libc/stdlib/strtonum.c b/lib/libc/stdlib/strtonum.c index 0bf29c3..6dccd97 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; |