Explorar o código

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 %!s(int64=10) %!d(string=hai) anos
pai
achega
ebd8142a6a
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  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;
 }