From 797cf20a0e490d56a80f8df483ca28db1e1f368d Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Tue, 1 Jul 2014 18:49:54 -0400 Subject: 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) --- 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; } -- cgit v1.2.1