about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2014-07-02 12:09:48 -0400
committerRich Felker <dalias@aerifal.cx>2014-07-28 00:27:58 -0400
commit7bbf7c12548fef40a0872e32d5c6f0903c5ea147 (patch)
tree44d543da2e775b1dc850fb0bb6182da1418f0a27
parent797cf20a0e490d56a80f8df483ca28db1e1f368d (diff)
downloadmusl-7bbf7c12548fef40a0872e32d5c6f0903c5ea147.tar.gz
musl-7bbf7c12548fef40a0872e32d5c6f0903c5ea147.tar.xz
musl-7bbf7c12548fef40a0872e32d5c6f0903c5ea147.zip
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.

(cherry picked from commit 984c25b74da085c6ae6b44a87bbd5f8afc9be331)
-rw-r--r--src/stdio/vfwprintf.c1
-rw-r--r--src/stdio/vfwscanf.c2
2 files changed, 3 insertions, 0 deletions
diff --git a/src/stdio/vfwprintf.c b/src/stdio/vfwprintf.c
index 984ff7b7..c6400591 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 f8f4b70f..ac5c2c24 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;