move call to dynamic linker stage-3 into stage-2 function
[musl] / src / stdio / fwide.c
index f4da47f..8088e7a 100644 (file)
@@ -1,3 +1,4 @@
+#include <wchar.h>
 #include "stdio_impl.h"
 
 #define SH (8*sizeof(int)-1)
@@ -5,6 +6,9 @@
 
 int fwide(FILE *f, int mode)
 {
+       FLOCK(f);
        if (!f->mode) f->mode = NORMALIZE(mode);
-       return f->mode;
+       mode = f->mode;
+       FUNLOCK(f);
+       return mode;
 }