summaryrefslogtreecommitdiff
path: root/src/internal/floatscan.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-04-19 12:47:34 -0400
committerRich Felker <dalias@aerifal.cx>2012-04-19 12:47:34 -0400
commitcb81b6947c0277a6a27ddc699d716e9cf2b524aa (patch)
tree50c78b49bb6d81a726b1d58026757e7d1185a9ac /src/internal/floatscan.c
parent769d3d349824fb45218972a1cf0e912cfee62d51 (diff)
downloadmusl-cb81b6947c0277a6a27ddc699d716e9cf2b524aa.tar.gz
fix really bad breakage in strtol, etc.: failure to accept leading spaces
Diffstat (limited to 'src/internal/floatscan.c')
-rw-r--r--src/internal/floatscan.c5
1 files changed, 3 insertions, 2 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=='-');