aboutsummaryrefslogtreecommitdiff
path: root/libio/fileops.c
diff options
context:
space:
mode:
authorPaul Pluzhnikov <ppluzhnikov@google.com>2018-12-31 19:14:28 -0800
committerPaul Pluzhnikov <ppluzhnikov@google.com>2019-01-31 14:07:45 -0800
commit5f10701fdc7a4708101f7931c15b7146c4f06690 (patch)
tree826e0575534318f16626af321a3c88cdd2761dfd /libio/fileops.c
parent583dd860d5b833037175247230a328f0050dbfe9 (diff)
downloadglibc-5f10701fdc7a4708101f7931c15b7146c4f06690.zip
glibc-5f10701fdc7a4708101f7931c15b7146c4f06690.tar.gz
glibc-5f10701fdc7a4708101f7931c15b7146c4f06690.tar.bz2
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/fileops.c')
-rw-r--r--libio/fileops.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libio/fileops.c b/libio/fileops.c
index 43e3382..d2070a8 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -501,13 +501,13 @@ _IO_new_file_underflow (FILE *fp)
traditional Unix systems did this for stdout. stderr better
not be line buffered. So we do just that here
explicitly. --drepper */
- _IO_acquire_lock (_IO_stdout);
+ _IO_acquire_lock (stdout);
- if ((_IO_stdout->_flags & (_IO_LINKED | _IO_NO_WRITES | _IO_LINE_BUF))
+ if ((stdout->_flags & (_IO_LINKED | _IO_NO_WRITES | _IO_LINE_BUF))
== (_IO_LINKED | _IO_LINE_BUF))
- _IO_OVERFLOW (_IO_stdout, EOF);
+ _IO_OVERFLOW (stdout, EOF);
- _IO_release_lock (_IO_stdout);
+ _IO_release_lock (stdout);
}
_IO_switch_to_get_mode (fp);