From ebd8142a6ae19db1a5440d11c01afc7529eae0cd Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Tue, 1 Jul 2014 18:49:54 -0400 Subject: [PATCH] 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. --- src/stdio/fwide.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; } -- 2.25.1