diff options
Diffstat (limited to 'src/lib/libc/stdlib/strtol.c')
-rw-r--r-- | src/lib/libc/stdlib/strtol.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/libc/stdlib/strtol.c b/src/lib/libc/stdlib/strtol.c index 745bc4c2ce..dc2cf8871c 100644 --- a/src/lib/libc/stdlib/strtol.c +++ b/src/lib/libc/stdlib/strtol.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: strtol.c,v 1.8 2012/11/18 04:13:39 jsing Exp $ */ | 1 | /* $OpenBSD: strtol.c,v 1.9 2013/04/17 17:40:35 tedu Exp $ */ |
2 | /*- | 2 | /*- |
3 | * Copyright (c) 1990 The Regents of the University of California. | 3 | * Copyright (c) 1990 The Regents of the University of California. |
4 | * All rights reserved. | 4 | * All rights reserved. |
@@ -54,7 +54,7 @@ strtol(const char *nptr, char **endptr, int base) | |||
54 | */ | 54 | */ |
55 | if (base != 0 && (base < 2 || base > 36)) { | 55 | if (base != 0 && (base < 2 || base > 36)) { |
56 | if (endptr != 0) | 56 | if (endptr != 0) |
57 | *endptr = nptr; | 57 | *endptr = (char *)nptr; |
58 | errno = EINVAL; | 58 | errno = EINVAL; |
59 | return 0; | 59 | return 0; |
60 | } | 60 | } |
@@ -124,7 +124,7 @@ strtol(const char *nptr, char **endptr, int base) | |||
124 | if (any < 0) | 124 | if (any < 0) |
125 | continue; | 125 | continue; |
126 | if (neg) { | 126 | if (neg) { |
127 | if (acc < cutoff || acc == cutoff && c > cutlim) { | 127 | if (acc < cutoff || (acc == cutoff && c > cutlim)) { |
128 | any = -1; | 128 | any = -1; |
129 | acc = LONG_MIN; | 129 | acc = LONG_MIN; |
130 | errno = ERANGE; | 130 | errno = ERANGE; |
@@ -134,7 +134,7 @@ strtol(const char *nptr, char **endptr, int base) | |||
134 | acc -= c; | 134 | acc -= c; |
135 | } | 135 | } |
136 | } else { | 136 | } else { |
137 | if (acc > cutoff || acc == cutoff && c > cutlim) { | 137 | if (acc > cutoff || (acc == cutoff && c > cutlim)) { |
138 | any = -1; | 138 | any = -1; |
139 | acc = LONG_MAX; | 139 | acc = LONG_MAX; |
140 | errno = ERANGE; | 140 | errno = ERANGE; |