diff options
author | Andrey A. Chernov <ache@FreeBSD.org> | 2006-03-14 19:53:03 +0000 |
---|---|---|
committer | Andrey A. Chernov <ache@FreeBSD.org> | 2006-03-14 19:53:03 +0000 |
commit | b0e1e343d883a556378c31e9f29ac983e687778f (patch) | |
tree | b8950e0d4cdcde25f71254fcc203a746d1173c7f /libc | |
parent | 6b1f2b23040c6c38b9216767f8c6a1631671e96d (diff) | |
download | pw-darwin-b0e1e343d883a556378c31e9f29ac983e687778f.tar.gz pw-darwin-b0e1e343d883a556378c31e9f29ac983e687778f.tar.zst pw-darwin-b0e1e343d883a556378c31e9f29ac983e687778f.zip |
POSIXed strtoll() (and ours one too) can set errno to EINVAL, so check
it first.
Approved by: andre
Diffstat (limited to 'libc')
-rw-r--r-- | libc/stdlib/strtonum.c | 2 |
1 files changed, 1 insertions, 1 deletions
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; |