aboutsummaryrefslogtreecommitdiff
path: root/newlib
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2009-01-28 18:12:52 +0000
committerJeff Johnston <jjohnstn@redhat.com>2009-01-28 18:12:52 +0000
commit3e703e875a7076a524a5f08c06ce831c119c6607 (patch)
tree63b140f873a8673da29cba82d513c59a8c174e41 /newlib
parent1ae0cd1335fd4874c7d3291e397d665cb4a19477 (diff)
downloadnewlib-3e703e875a7076a524a5f08c06ce831c119c6607.zip
newlib-3e703e875a7076a524a5f08c06ce831c119c6607.tar.gz
newlib-3e703e875a7076a524a5f08c06ce831c119c6607.tar.bz2
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')
-rw-r--r--newlib/ChangeLog6
-rw-r--r--newlib/libc/stdio/vfscanf.c8
2 files changed, 12 insertions, 2 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index 7dc10fe..965f986 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,3 +1,9 @@
+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.
+
2009-01-26 DJ Delorie <dj@redhat.com>
* configure.host (m32c-*-*): Add long long I/O support by default.
diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c
index 98c3db6..8546088 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;
}