summaryrefslogtreecommitdiff
path: root/src/stdio
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2014-07-01 18:49:54 -0400
committerRich Felker <dalias@aerifal.cx>2014-07-28 00:27:58 -0400
commit797cf20a0e490d56a80f8df483ca28db1e1f368d (patch)
tree9995f1439cff7bcb77a39cf4375493265f61ddc4 /src/stdio
parent726df5a8bc03a30afdb123edfeae5da180b77f79 (diff)
downloadmusl-797cf20a0e490d56a80f8df483ca28db1e1f368d.tar.gz
fix incorrect return value for fwide function
when the orientation of the stream was already set, fwide was incorrectly returning its argument (the requested orientation) rather than the actual orientation of the stream. (cherry picked from commit ebd8142a6ae19db1a5440d11c01afc7529eae0cd)
Diffstat (limited to 'src/stdio')
-rw-r--r--src/stdio/fwide.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/stdio/fwide.c b/src/stdio/fwide.c
index fdf8e4bb..8088e7ad 100644
--- a/src/stdio/fwide.c
+++ b/src/stdio/fwide.c
@@ -7,7 +7,8 @@
int fwide(FILE *f, int mode)
{
FLOCK(f);
- if (!f->mode) mode = f->mode = NORMALIZE(mode);
+ if (!f->mode) f->mode = NORMALIZE(mode);
+ mode = f->mode;
FUNLOCK(f);
return mode;
}