remove invalid skip of locking in ungetwc
[musl] / src / stdio / vfwscanf.c
index 760864f..ac5c2c2 100644 (file)
@@ -6,9 +6,6 @@
 #include <wctype.h>
 #include <limits.h>
 #include <string.h>
-#include <errno.h>
-#include <math.h>
-#include <float.h>
 
 #include "stdio_impl.h"
 #include "shgetc.h"
@@ -107,8 +104,12 @@ int vfwscanf(FILE *restrict f, const wchar_t *restrict fmt, va_list ap)
 
        FLOCK(f);
 
+       f->mode |= f->mode+1;
+
        for (p=fmt; *p; p++) {
 
+               alloc = 0;
+
                if (iswspace(*p)) {
                        while (iswspace(p[1])) p++;
                        while (iswspace((c=getwc(f)))) pos++;
@@ -141,6 +142,8 @@ int vfwscanf(FILE *restrict f, const wchar_t *restrict fmt, va_list ap)
                }
 
                if (*p=='m') {
+                       wcs = 0;
+                       s = 0;
                        alloc = !!dest;
                        p++;
                } else {