re-enable vdso clock_gettime on arm (32-bit) with workaround
[musl] / src / internal / intscan.c
index 178cdf0..a4a5ae8 100644 (file)
@@ -1,5 +1,6 @@
 #include <limits.h>
 #include <errno.h>
+#include <ctype.h>
 #include "shgetc.h"
 
 /* Lookup table for digit values. -1==255>=36 -> invalid */
@@ -28,7 +29,7 @@ unsigned long long __intscan(FILE *f, unsigned base, int pok, unsigned long long
        int c, neg=0;
        unsigned x;
        unsigned long long y;
-       if (base > 36) {
+       if (base > 36 || base == 1) {
                errno = EINVAL;
                return 0;
        }
@@ -82,6 +83,7 @@ unsigned long long __intscan(FILE *f, unsigned base, int pok, unsigned long long
                for (; val[c]<base; c=shgetc(f));
                errno = ERANGE;
                y = lim;
+               if (lim&1) neg = 0;
        }
 done:
        shunget(f);