mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
* stdio-common/vfscanf.c (_IO_vfscanf): Add additional test for EOF
in loop to look for conversion specifier to avoid testing of wrong errno value. * stdio-common/Makefile (tests): Add bug18, bug18a, bug19, bug19a. * stdio-common/bug18a.c: New file. * stdio-common/bug19.c: New file. * stdio-common/bug19a.c: New file.
This commit is contained in:
@ -530,12 +530,17 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
|
||||
{
|
||||
/* Eat whitespace. */
|
||||
int save_errno = errno;
|
||||
errno = 0;
|
||||
__set_errno (0);
|
||||
do
|
||||
if (__builtin_expect (inchar () == EOF && errno == EINTR, 0))
|
||||
/* We add the additional test for EOF here since otherwise
|
||||
inchar will restore the old errno value which might be
|
||||
EINTR but does not indicate an interrupt since nothing
|
||||
was read at this time. */
|
||||
if (__builtin_expect ((c == EOF || inchar () == EOF)
|
||||
&& errno == EINTR, 0))
|
||||
input_error ();
|
||||
while (ISSPACE (c));
|
||||
errno = save_errno;
|
||||
__set_errno (save_errno);
|
||||
ungetc (c, s);
|
||||
skip_space = 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user