diff options
author | Ulrich Drepper <drepper@redhat.com> | 2007-07-08 04:41:34 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2007-07-08 04:41:34 +0000 |
commit | 0923a2c896f09795cca4a6d800a336a56b0ee42c (patch) | |
tree | 10038ab54362ef2ee4ab5384e39dacce92d18d9e /stdio-common/vfscanf.c | |
parent | e9055017f6d2015c4c74c94b1c2bf59968db223f (diff) | |
download | glibc-0923a2c896f09795cca4a6d800a336a56b0ee42c.tar glibc-0923a2c896f09795cca4a6d800a336a56b0ee42c.tar.gz glibc-0923a2c896f09795cca4a6d800a336a56b0ee42c.tar.bz2 glibc-0923a2c896f09795cca4a6d800a336a56b0ee42c.zip |
* 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.
Diffstat (limited to 'stdio-common/vfscanf.c')
-rw-r--r-- | stdio-common/vfscanf.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c index b1469b9a9e..9e6daced5d 100644 --- a/stdio-common/vfscanf.c +++ b/stdio-common/vfscanf.c @@ -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; } |