about 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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/stdlib/strtol.c b/stdlib/strtol.c
index 93df6ab661..96157ef400 100644
--- a/stdlib/strtol.c
+++ b/stdlib/strtol.c
@@ -306,7 +306,7 @@ INTERNAL (strtol) (nptr, endptr, base, group LOCALE_PARAM)
   /* Recognize number prefix and if BASE is zero, figure it out ourselves.  */
   if (*s == L_('0'))
     {
-      if (TOUPPER (s[1]) == L_('X'))
+      if ((base == 0 || base == 16) && TOUPPER (s[1]) == L_('X'))
 	{
 	  s += 2;
 	  base = 16;