rewrite popen to use posix_spawn instead of fragile vfork hacks
[musl] / src / stdio / fgetwc.c
index 77b30fd..8626d54 100644 (file)
@@ -1,4 +1,6 @@
 #include "stdio_impl.h"
+#include <wchar.h>
+#include <errno.h>
 
 wint_t __fgetwc_unlocked(FILE *f)
 {
@@ -23,9 +25,9 @@ wint_t __fgetwc_unlocked(FILE *f)
                }
        } else l = -2;
 
-       /* Convert character byte-by-byte from __uflow */
+       /* Convert character byte-by-byte */
        while (l == -2) {
-               b = c = __uflow(f);
+               b = c = getc_unlocked(f);
                if (c < 0) {
                        if (!mbsinit(&st)) errno = EILSEQ;
                        return WEOF;
@@ -34,7 +36,6 @@ wint_t __fgetwc_unlocked(FILE *f)
                if (l == -1) return WEOF;
        }
 
-       FUNLOCK(f);
        return wc;
 }