summaryrefslogtreecommitdiffstats
path: root/main/musl/0004-fix-failure-of-wide-printf-scanf-functions-to-set-wi.patch
blob: 54edaf8c3c84d885177dcfc2ce776c7eba7efc24 (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
30
31
32
33
34
35
36
37
38
39
40
41
42
From 984c25b74da085c6ae6b44a87bbd5f8afc9be331 Mon Sep 17 00:00:00 2001
From: Rich Felker <dalias@aerifal.cx>
Date: Wed, 2 Jul 2014 12:09:48 -0400
Subject: [PATCH] fix failure of wide printf/scanf functions to set wide
 orientation

in some cases, these functions internally call a byte-based input or
output function before calling getwc/putwc, so they cannot rely on the
latter to set the orientation.
---
 src/stdio/vfwprintf.c | 1 +
 src/stdio/vfwscanf.c  | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/src/stdio/vfwprintf.c b/src/stdio/vfwprintf.c
index 984ff7b..c640059 100644
--- a/src/stdio/vfwprintf.c
+++ b/src/stdio/vfwprintf.c
@@ -355,6 +355,7 @@ int vfwprintf(FILE *restrict f, const wchar_t *restrict fmt, va_list ap)
 	}
 
 	FLOCK(f);
+	f->mode |= f->mode+1;
 	ret = wprintf_core(f, fmt, &ap2, nl_arg, nl_type);
 	FUNLOCK(f);
 	va_end(ap2);
diff --git a/src/stdio/vfwscanf.c b/src/stdio/vfwscanf.c
index f8f4b70..ac5c2c2 100644
--- a/src/stdio/vfwscanf.c
+++ b/src/stdio/vfwscanf.c
@@ -104,6 +104,8 @@ int vfwscanf(FILE *restrict f, const wchar_t *restrict fmt, va_list ap)
 
 	FLOCK(f);
 
+	f->mode |= f->mode+1;
+
 	for (p=fmt; *p; p++) {
 
 		alloc = 0;
-- 
2.0.1