about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2014-07-01 18:49:54 -0400
committerRich Felker <dalias@aerifal.cx>2014-07-01 18:49:54 -0400
commitebd8142a6ae19db1a5440d11c01afc7529eae0cd (patch)
tree665eb963963c3c7748729e1240861dbd9ecf933e /src
parent0b3d33d4d27731f0d80f726fd114c8b9cb3322be (diff)
downloadmusl-ebd8142a6ae19db1a5440d11c01afc7529eae0cd.tar.gz
musl-ebd8142a6ae19db1a5440d11c01afc7529eae0cd.tar.xz
musl-ebd8142a6ae19db1a5440d11c01afc7529eae0cd.zip
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.
Diffstat (limited to 'src')
-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;
 }