1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

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.
This commit is contained in:
Florian Weimer
2019-02-03 09:37:30 +01:00
parent c70824b9a4
commit ee9941f94e
11 changed files with 157 additions and 29 deletions

View File

@ -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;
}