diff options
author | Paul Pluzhnikov <ppluzhnikov@google.com> | 2018-12-31 19:14:28 -0800 |
---|---|---|
committer | Paul Pluzhnikov <ppluzhnikov@google.com> | 2019-01-31 14:07:45 -0800 |
commit | 5f10701fdc7a4708101f7931c15b7146c4f06690 (patch) | |
tree | 826e0575534318f16626af321a3c88cdd2761dfd /libio/ioputs.c | |
parent | 583dd860d5b833037175247230a328f0050dbfe9 (diff) | |
download | glibc-5f10701fdc7a4708101f7931c15b7146c4f06690.tar.gz glibc-5f10701fdc7a4708101f7931c15b7146c4f06690.tar.xz glibc-5f10701fdc7a4708101f7931c15b7146c4f06690.zip |
libio: use stdout in puts and putchar, etc [BZ #24051].
GLIBC explicitly allows one to assign a new FILE pointer to stdout and other standard streams. printf and wprintf were honouring assignment to stdout and using the new value, but puts, putchar, and wide char variants did not. The stdout part is fixed here. The stdin part will be fixed in a followup.
Diffstat (limited to 'libio/ioputs.c')
-rw-r--r-- | libio/ioputs.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libio/ioputs.c b/libio/ioputs.c index 04ae323c6d..319e551de5 100644 --- a/libio/ioputs.c +++ b/libio/ioputs.c @@ -33,15 +33,15 @@ _IO_puts (const char *str) { int result = EOF; size_t len = strlen (str); - _IO_acquire_lock (_IO_stdout); + _IO_acquire_lock (stdout); - if ((_IO_vtable_offset (_IO_stdout) != 0 - || _IO_fwide (_IO_stdout, -1) == -1) - && _IO_sputn (_IO_stdout, str, len) == len - && _IO_putc_unlocked ('\n', _IO_stdout) != EOF) + if ((_IO_vtable_offset (stdout) != 0 + || _IO_fwide (stdout, -1) == -1) + && _IO_sputn (stdout, str, len) == len + && _IO_putc_unlocked ('\n', stdout) != EOF) result = MIN (INT_MAX, len + 1); - _IO_release_lock (_IO_stdout); + _IO_release_lock (stdout); return result; } |