From ee9941f94ea838774c34f60b3397fba07a803d92 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Sun, 3 Feb 2019 09:37:30 +0100 Subject: libio: Use stdin consistently for input functions [BZ #24153] The internal _IO_stdin_ variable is not updated when the application assigns to stdin, which is a GNU extension. --- libio/getchar.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libio/getchar.c') diff --git a/libio/getchar.c b/libio/getchar.c index 7e385305ff..90dea38ddb 100644 --- a/libio/getchar.c +++ b/libio/getchar.c @@ -33,11 +33,11 @@ int getchar (void) { int result; - if (!_IO_need_lock (_IO_stdin)) - return _IO_getc_unlocked (_IO_stdin); - _IO_acquire_lock (_IO_stdin); - result = _IO_getc_unlocked (_IO_stdin); - _IO_release_lock (_IO_stdin); + if (!_IO_need_lock (stdin)) + return _IO_getc_unlocked (stdin); + _IO_acquire_lock (stdin); + result = _IO_getc_unlocked (stdin); + _IO_release_lock (stdin); return result; } -- cgit 1.4.1