소스 검색

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.
Rich Felker 10 년 전
부모
커밋
ebd8142a6a
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)
 int fwide(FILE *f, int mode)
 {
 {
 	FLOCK(f);
 	FLOCK(f);
-	if (!f->mode) mode = f->mode = NORMALIZE(mode);
+	if (!f->mode) f->mode = NORMALIZE(mode);
+	mode = f->mode;
 	FUNLOCK(f);
 	FUNLOCK(f);
 	return mode;
 	return mode;
 }
 }