summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2004-05-03 20:53:35 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2004-05-03 20:53:35 +0000
commit1d52dc1b576a666e43b2ab4103f641f6123759f4 (patch)
treee5756fab9668ad07d22f514d23ed6b5d6788e9e0
parentf614fff3d68c13a83e855c43b135e5245fb84f73 (diff)
Be smarter about signed vs. unsigned (produces better error messages).
OK otto@
-rw-r--r--lib/libc/stdlib/strtonum.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/stdlib/strtonum.c b/lib/libc/stdlib/strtonum.c
index 9ac0d34ee00..a7f07c9062c 100644
--- a/lib/libc/stdlib/strtonum.c
+++ b/lib/libc/stdlib/strtonum.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: strtonum.c,v 1.1 2004/05/03 17:09:24 tedu Exp $ */
+/* $OpenBSD: strtonum.c,v 1.2 2004/05/03 20:53:34 millert Exp $ */
/*
* Copyright (c) 2004 Ted Unangst and Todd Miller
* All rights reserved.
@@ -48,7 +48,7 @@ strtonum(const char *numstr, long long minval, unsigned long long maxval,
if (minval > maxval || maxval < minval ||
(minval < 0 && maxval > LLONG_MAX))
error = INVALID;
- else if (minval >= 0) {
+ else if (maxval > LLONG_MAX ) {
ull = strtoull(numstr, &ep, 10);
if (numstr == ep || *ep != '\0')
error = INVALID;