summaryrefslogtreecommitdiff
path: root/src/stdio/fwide.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdio/fwide.c')
-rw-r--r--src/stdio/fwide.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/stdio/fwide.c b/src/stdio/fwide.c
index f4da47f6..48480685 100644
--- a/src/stdio/fwide.c
+++ b/src/stdio/fwide.c
@@ -5,6 +5,8 @@
int fwide(FILE *f, int mode)
{
- if (!f->mode) f->mode = NORMALIZE(mode);
- return f->mode;
+ FLOCK(f);
+ if (!f->mode) mode = f->mode = NORMALIZE(mode);
+ FUNLOCK(f);
+ return mode;
}