summaryrefslogtreecommitdiff
path: root/src/stdio/vfwscanf.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-04-17 23:08:58 -0400
committerRich Felker <dalias@aerifal.cx>2012-04-17 23:08:58 -0400
commita12aa2918535fd370419bd24b50a33974091c5a7 (patch)
tree1a3f5c791708fcbd89f15248e57f8d24bff9004d /src/stdio/vfwscanf.c
parent2dd5dc78d4502381e2933137ed525acf339cb383 (diff)
downloadmusl-a12aa2918535fd370419bd24b50a33974091c5a7.tar.gz
fix failure to distinguish input/match failure in wide %[ scanf
this also includes a related fix for vswscanf's read function, which was returning a spurious (uninitialized) character for empty strings.
Diffstat (limited to 'src/stdio/vfwscanf.c')
-rw-r--r--src/stdio/vfwscanf.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/stdio/vfwscanf.c b/src/stdio/vfwscanf.c
index a52ba3a0..dbba8652 100644
--- a/src/stdio/vfwscanf.c
+++ b/src/stdio/vfwscanf.c
@@ -264,7 +264,9 @@ int vfwscanf(FILE *f, const wchar_t *fmt, va_list ap)
}
if (width) ungetwc(c, f);
- if (!gotmatch) goto match_fail;
+ if (!gotmatch)
+ if (c>=0) goto match_fail;
+ else goto input_fail;
if (*p==']') p++;
while (*p!=']') {