summaryrefslogtreecommitdiffstats
path: root/main/musl/0003-fix-incorrect-return-value-for-fwide-function.patch
blob: 7e5087858a550dc3cd515567c2e39b20c14efd9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
From ebd8142a6ae19db1a5440d11c01afc7529eae0cd Mon Sep 17 00:00:00 2001
From: Rich Felker <dalias@aerifal.cx>
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 fdf8e4b..8088e7a 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.0.1