about summary refs log tree commit diff
path: root/stdio
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-08-25 19:23:32 +0000
committerRoland McGrath <roland@gnu.org>1995-08-25 19:23:32 +0000
commit7752137a6a9d9a042d2c2f00e245b920e41737bc (patch)
treed0d12093452de95c4c7a609bd14d0094439ad956 /stdio
parent3cf595e562f955e399d80ea9d053e41d50469e6b (diff)
downloadglibc-7752137a6a9d9a042d2c2f00e245b920e41737bc.tar.gz
glibc-7752137a6a9d9a042d2c2f00e245b920e41737bc.tar.xz
glibc-7752137a6a9d9a042d2c2f00e245b920e41737bc.zip
Fri Aug 25 12:12:42 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
	* sysdeps/mach/hurd/mmap.c: Fix inverted test of MAP_FIXED.

	* stdio/vfscanf.c (number): Allow field width to inhibit first
	digit after base detection.

	* stdio/vfprintf.c (vfprintf: %s): Never search past the limit
	specified by the precision.

	* grp/grpread.c (__grpscan): New function.
	* grp/grp.h (__grpscan): Declare it.
	* grp/getgrgid.c: Use __grpscan.
	* grp/getgrnam.c: Likewise.
	* pwd/pwdread.c (__pwdscan): New function.
	* pwd/pwd.h (__pwdscan): Declare it.
	* pwd/getpwnam.c: Use __pwdscan.
	* pwd/getpwuid.c: Likewise.

Thu Aug 24 16:29:40 1995  Roland McGrath  <roland@churchy.gnu.ai.mit.edu>

	* sysdeps/mach/hurd/mmap.c: Treat (FLAGS & MAP_TYPE) == 0 like
	MAP_FILE.

	* hurd/thread-cancel.c: Return EINTR when called on self.
	* sysdeps/i386/elf/start.S (data_start): Define as weak alias for
	__data_start.
Diffstat (limited to 'stdio')
-rw-r--r--stdio/vfprintf.c13
-rw-r--r--stdio/vfscanf.c7
2 files changed, 8 insertions, 12 deletions
diff --git a/stdio/vfprintf.c b/stdio/vfprintf.c
index 1246229a63..06aa0a0e7d 100644
--- a/stdio/vfprintf.c
+++ b/stdio/vfprintf.c
@@ -533,21 +533,16 @@ vfprintf (s, format, ap)
 		}
               else if (specs[cnt].info.prec != -1)
 		{
+		  /* Search for the end of the string, but don't search
+                     past the length specified by the precision.  */
 		  const char *end = memchr (str, '\0', specs[cnt].info.prec);
 		  if (end)
 		    len = end - str;
 		  else
-		    len = strlen (str);
-		}
-	      else
-		{
-		  len = strlen (str);
-
-		  if (specs[cnt].info.prec != -1
-		      && (size_t) specs[cnt].info.prec < len)
-		    /* Limit the length to the precision.  */
 		    len = specs[cnt].info.prec;
 		}
+	      else
+		len = strlen (str);
 
               specs[cnt].info.width -= len;
 
diff --git a/stdio/vfscanf.c b/stdio/vfscanf.c
index 6eacc2b309..a778346287 100644
--- a/stdio/vfscanf.c
+++ b/stdio/vfscanf.c
@@ -422,7 +422,7 @@ DEFUN(__vfscanf, (s, format, arg),
 	    base = 10;
 
 	  /* Read the number into WORK.  */
-	  do
+	  while (width != 0 && c != EOF)
 	    {
 	      if (base == 16 ? !isxdigit(c) :
 		  (!isdigit(c) || c - '0' >= base))
@@ -430,11 +430,12 @@ DEFUN(__vfscanf, (s, format, arg),
 	      *w++ = c;
 	      if (width > 0)
 		--width;
-	    } while (inchar() != EOF && width != 0);
+	      (void) inchar ();
+	    }
 
 	  if (w == work ||
 	      (w - work == 1 && (work[0] == '+' || work[0] == '-')))
-	    /* There was on number.  */
+	    /* There was no number.  */
 	    conv_error();
 
 	  /* Convert the number.  */