summaryrefslogtreecommitdiff
path: root/lib/strtol.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1997-02-21 02:16:54 +0000
committerJim Meyering <jim@meyering.net>1997-02-21 02:16:54 +0000
commite16668553e4aed3f982ef24123fbc66ca30bb416 (patch)
treec7a08e76c1d33ae27f6aba48c8f69e29d4c366b9 /lib/strtol.c
parent3b459d46bc33c960176e92de221dcbc55c4d61e2 (diff)
downloadcoreutils-e16668553e4aed3f982ef24123fbc66ca30bb416.tar.xz
update from FSF
Diffstat (limited to 'lib/strtol.c')
-rw-r--r--lib/strtol.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/strtol.c b/lib/strtol.c
index 025287a3f..0d3ec1bab 100644
--- a/lib/strtol.c
+++ b/lib/strtol.c
@@ -1,5 +1,5 @@
/* strtol - Convert string representation of a number into an integer value.
- Copyright (C) 1991, 92, 94, 95, 96 Free Software Foundation, Inc.
+ Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C
Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu.
@@ -201,7 +201,10 @@ INTERNAL (strtol) (nptr, endptr, base, group)
#endif
if (base < 0 || base == 1 || base > 36)
- base = 10;
+ {
+ __set_errno (EINVAL);
+ return 0;
+ }
save = s = nptr;
@@ -309,6 +312,8 @@ INTERNAL (strtol) (nptr, endptr, base, group)
? -((unsigned LONG int) (LONG_MIN + 1)) + 1
: (unsigned LONG int) LONG_MAX))
overflow = 1;
+#else
+ overflow |= negative;
#endif
if (overflow)