summary refs log tree commit diff
path: root/stdlib/strtol.c
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/strtol.c')
-rw-r--r--stdlib/strtol.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/stdlib/strtol.c b/stdlib/strtol.c
index 1481d3388e..5543ab94d1 100644
--- a/stdlib/strtol.c
+++ b/stdlib/strtol.c
@@ -31,6 +31,9 @@ Cambridge, MA 02139, USA.  */
 #ifndef errno
 extern int errno;
 #endif
+#ifndef __set_errno
+# define __set_errno(val) errno = (val)
+#endif
 
 #ifdef HAVE_LIMITS_H
 # include <limits.h>
@@ -309,7 +312,7 @@ INTERNAL (strtol) (nptr, endptr, base, group)
 
   if (overflow)
     {
-      errno = ERANGE;
+      __set_errno (ERANGE);
 #if UNSIGNED
       return ULONG_MAX;
 #else