about summary refs log tree commit diff
path: root/stdio-common
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-04-27 11:31:41 +0000
committerJakub Jelinek <jakub@redhat.com>2005-04-27 11:31:41 +0000
commit35278cc7d7fe81e01bb092e76b775c169e7e85f6 (patch)
tree6ec42ab959998df5c0182183807ee2b9efc4cc91 /stdio-common
parent536db0d3b5efac042be3bf1d6f99f9c418f76255 (diff)
downloadglibc-35278cc7d7fe81e01bb092e76b775c169e7e85f6.tar.gz
glibc-35278cc7d7fe81e01bb092e76b775c169e7e85f6.tar.xz
glibc-35278cc7d7fe81e01bb092e76b775c169e7e85f6.zip
Updated to fedora-glibc-20050427T1043
Diffstat (limited to 'stdio-common')
-rw-r--r--stdio-common/vfscanf.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c
index c641d2d371..be008dc687 100644
--- a/stdio-common/vfscanf.c
+++ b/stdio-common/vfscanf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -1602,6 +1602,8 @@ _IO_vfscanf (s, format, argptr, errp)
 	  if (c == EOF)
 	    input_error ();
 
+	  got_dot = got_e = 0;
+
 	  /* Check for a sign.  */
 	  if (c == L_('-') || c == L_('+'))
 	    {
@@ -1629,14 +1631,13 @@ _IO_vfscanf (s, format, argptr, errp)
 		  const char *cmpp = decimal;
 		  int avail = width > 0 ? width : INT_MAX;
 
-		  while ((unsigned char) *cmpp == c && avail > 0)
+		  while ((unsigned char) *cmpp == c && avail-- > 0)
 		    if (*++cmpp == '\0')
 		      break;
 		    else
 		      {
 			if (inchar () == EOF)
 			  break;
-			--avail;
 		      }
 
 		  if (*cmpp != '\0')
@@ -1652,6 +1653,17 @@ _IO_vfscanf (s, format, argptr, errp)
 
 		      conv_error ();
 		    }
+		  else
+		    {
+                     /* Add all the characters.  */
+                     for (cmpp = decimal; *cmpp != '\0'; ++cmpp)
+                       ADDW ((unsigned char) *cmpp);
+                     if (width > 0)
+                       width = avail;
+                     got_dot = 1;
+
+		      c = inchar ();
+		    }
 		  if (width > 0)
 		    width = avail;
 #endif
@@ -1759,7 +1771,6 @@ _IO_vfscanf (s, format, argptr, errp)
 		}
 	    }
 
-	  got_dot = got_e = 0;
 	  do
 	    {
 	      if (ISDIGIT (c))