fix failure of wide printf/scanf functions to set wide orientation
authorRich Felker <dalias@aerifal.cx>
Wed, 2 Jul 2014 16:09:48 +0000 (12:09 -0400)
committerRich Felker <dalias@aerifal.cx>
Wed, 2 Jul 2014 16:09:48 +0000 (12:09 -0400)
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
src/stdio/vfwscanf.c

index 984ff7b..c640059 100644 (file)
@@ -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);
index f8f4b70..ac5c2c2 100644 (file)
@@ -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;