diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2009-01-28 18:12:52 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2009-01-28 18:12:52 +0000 |
commit | 3e703e875a7076a524a5f08c06ce831c119c6607 (patch) | |
tree | 63b140f873a8673da29cba82d513c59a8c174e41 /newlib/libc/stdio | |
parent | 1ae0cd1335fd4874c7d3291e397d665cb4a19477 (diff) | |
download | cygnal-3e703e875a7076a524a5f08c06ce831c119c6607.tar.gz cygnal-3e703e875a7076a524a5f08c06ce831c119c6607.tar.bz2 cygnal-3e703e875a7076a524a5f08c06ce831c119c6607.zip |
2009-01-28 Jeff Johnston <jjohnstn@redhat.com>
* libc/stdio/vfscanf.c (__SVFSCANF_R): Add additional check for
inf and nan processing to not proceed if we have already collected
zeroes.
Diffstat (limited to 'newlib/libc/stdio')
-rw-r--r-- | newlib/libc/stdio/vfscanf.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c index 98c3db696..8546088a8 100644 --- a/newlib/libc/stdio/vfscanf.c +++ b/newlib/libc/stdio/vfscanf.c @@ -489,6 +489,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), # define GET_ARG(n, ap, type) (va_arg (ap, type)) #endif + __sfp_lock_acquire (); _flockfile (fp); ORIENT (fp, -1); @@ -779,6 +780,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), */ case '\0': /* compat */ _funlockfile (fp); + __sfp_lock_release (); return EOF; default: /* compat */ @@ -1329,7 +1331,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), break; case 'n': case 'N': - if (nancount == 0 + if (nancount == 0 && zeroes == 0 && (flags & (NDIGITS | DPTOK | EXPOK)) == (NDIGITS | DPTOK | EXPOK)) { @@ -1358,7 +1360,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), break; case 'i': case 'I': - if (infcount == 0 + if (infcount == 0 && zeroes == 0 && (flags & (NDIGITS | DPTOK | EXPOK)) == (NDIGITS | DPTOK | EXPOK)) { @@ -1577,11 +1579,13 @@ input_failure: invalid format string), return EOF if no matches yet, else number of matches made prior to failure. */ _funlockfile (fp); + __sfp_lock_release (); return nassigned && !(fp->_flags & __SERR) ? nassigned : EOF; match_failure: all_done: /* Return number of matches, which can be 0 on match failure. */ _funlockfile (fp); + __sfp_lock_release (); return nassigned; } |