diff options
author | Rich Felker <dalias@aerifal.cx> | 2012-04-19 12:47:34 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2012-04-19 12:47:34 -0400 |
commit | cb81b6947c0277a6a27ddc699d716e9cf2b524aa (patch) | |
tree | 50c78b49bb6d81a726b1d58026757e7d1185a9ac /src/internal | |
parent | 769d3d349824fb45218972a1cf0e912cfee62d51 (diff) | |
download | musl-cb81b6947c0277a6a27ddc699d716e9cf2b524aa.tar.gz musl-cb81b6947c0277a6a27ddc699d716e9cf2b524aa.tar.bz2 musl-cb81b6947c0277a6a27ddc699d716e9cf2b524aa.tar.xz musl-cb81b6947c0277a6a27ddc699d716e9cf2b524aa.zip |
fix really bad breakage in strtol, etc.: failure to accept leading spaces
Diffstat (limited to 'src/internal')
-rw-r--r-- | src/internal/floatscan.c | 5 | ||||
-rw-r--r-- | src/internal/floatscan.h | 2 | ||||
-rw-r--r-- | src/internal/intscan.c | 2 |
3 files changed, 5 insertions, 4 deletions
diff --git a/src/internal/floatscan.c b/src/internal/floatscan.c index 32175431..7381e9a4 100644 --- a/src/internal/floatscan.c +++ b/src/internal/floatscan.c @@ -394,12 +394,13 @@ static long double hexfloat(FILE *f, int bits, int emin, int sign, int pok) return scalbnl(y, e2); } -long double __floatscan(FILE *f, int c, int prec, int pok) +long double __floatscan(FILE *f, int prec, int pok) { int sign = 1; int i; int bits; int emin; + int c; switch (prec) { case 0: @@ -418,7 +419,7 @@ long double __floatscan(FILE *f, int c, int prec, int pok) return 0; } - if (c<0) c = shgetc(f); + while (isspace((c=shgetc(f)))); if (c=='+' || c=='-') { sign -= 2*(c=='-'); diff --git a/src/internal/floatscan.h b/src/internal/floatscan.h index 5595b81e..e027fa08 100644 --- a/src/internal/floatscan.h +++ b/src/internal/floatscan.h @@ -3,6 +3,6 @@ #include <stdio.h> -long double __floatscan(FILE *, int, int, int); +long double __floatscan(FILE *, int, int); #endif diff --git a/src/internal/intscan.c b/src/internal/intscan.c index d65fc45c..178cdf0d 100644 --- a/src/internal/intscan.c +++ b/src/internal/intscan.c @@ -32,7 +32,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); |