浏览代码

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)
Rich Felker 10 年之前
父节点
当前提交
797cf20a0e
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      src/stdio/fwide.c

+ 2 - 1
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;
 }