X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Finternal%2Fintscan.c;h=69350efa6380ed65577cdcad84f7d470cd234b3c;hb=e42a977fe5dbe48ba45072ab82886e6b5a694487;hp=a00f2ccc2206de3acfd2641c1f33b65f015c6580;hpb=18efeb320b763e541a7dbf61a7da1cbe13ab2be9;p=musl diff --git a/src/internal/intscan.c b/src/internal/intscan.c index a00f2ccc..69350efa 100644 --- a/src/internal/intscan.c +++ b/src/internal/intscan.c @@ -1,5 +1,6 @@ #include #include +#include #include "shgetc.h" /* Lookup table for digit values. -1==255>=36 -> invalid */ @@ -32,7 +33,7 @@ unsigned long long __intscan(FILE *f, unsigned base, int pok, unsigned long long errno = EINVAL; return 0; } - c = shgetc(f); + while (isspace((c=shgetc(f)))); if (c=='+' || c=='-') { neg = -(c=='-'); c = shgetc(f); @@ -54,6 +55,7 @@ unsigned long long __intscan(FILE *f, unsigned base, int pok, unsigned long long } else { if (base == 0) base = 10; if (val[c] >= base) { + shunget(f); shlim(f, 0); errno = EINVAL; return 0;