summary refs log tree commit diff
path: root/stdio-common
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-11-13 19:38:37 +0000
committerUlrich Drepper <drepper@redhat.com>1998-11-13 19:38:37 +0000
commit27658f2067a43aeddd03a98a562020ae9fea92c6 (patch)
tree20a47d05a34bbf147f24631cc9793487fe379056 /stdio-common
parent77d10f94bf43b73394f9a3eaf1052c4bfc52905f (diff)
downloadglibc-27658f2067a43aeddd03a98a562020ae9fea92c6.tar.gz
glibc-27658f2067a43aeddd03a98a562020ae9fea92c6.tar.xz
glibc-27658f2067a43aeddd03a98a562020ae9fea92c6.zip
Update.
	* stdio-common/vfscanf.c: Don't return -1 in case of an invalid
	format, jsut stop.
Diffstat (limited to 'stdio-common')
-rw-r--r--stdio-common/tstdiomisc.c17
-rw-r--r--stdio-common/vfscanf.c11
2 files changed, 13 insertions, 15 deletions
diff --git a/stdio-common/tstdiomisc.c b/stdio-common/tstdiomisc.c
index e99457f510..1affac5b51 100644
--- a/stdio-common/tstdiomisc.c
+++ b/stdio-common/tstdiomisc.c
@@ -21,17 +21,24 @@ t2 (void)
   VAR = -1; \
   retval = sscanf (INPUT, FORMAT, &VAR); \
   printf ("sscanf (\"%s\", \"%s\", &x) => %d, x = %ld\n", \
-	  INPUT, FORMAT, retval, VAR); \
+	  INPUT, FORMAT, retval, (long int) VAR); \
   result |= retval != EXP_RES || VAR != EXP_VAL
 
   SCAN ("12345", "%ld", N, 1, 12345);
-  SCAN ("12345", "%llllld", N, -1, -1);
-  SCAN ("12345", "%LLLLLd", N, -1, -1);
+  SCAN ("12345", "%llllld", N, 0, -1);
+  SCAN ("12345", "%LLLLLd", N, 0, -1);
   SCAN ("test ", "%*s%n",  n, 0, 4);
-  SCAN ("test ", "%2*s%n",  n, -1, -1);
-  SCAN ("12 ",   "%l2d",  n, -1, -1);
+  SCAN ("test ", "%2*s%n",  n, 0, -1);
+  SCAN ("12 ",   "%l2d",  n, 0, -1);
   SCAN ("12 ",   "%2ld",  N, 1, 12);
 
+  n = -1;
+  N = -1;
+  retval = sscanf ("1 1", "%d %Z", &n, &N);
+  printf ("sscanf (\"1 1\", \"%%d %%Z\", &n, &N) => %d, n = %d, N = %ld\n", \
+	  retval, n, N); \
+  result |= retval != 1 || n != 1 || N != -1;
+
   return result;
 }
 
diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c
index d2302dd9a2..1b6dc6537d 100644
--- a/stdio-common/vfscanf.c
+++ b/stdio-common/vfscanf.c
@@ -85,11 +85,6 @@
 			  __libc_cleanup_end (0);			      \
 			  return EOF;					      \
 			} while (0)
-# define fmt_error()	do {						      \
-			  _IO_funlockfile (s);				      \
-			  __libc_cleanup_end (0);			      \
-			  return EOF;					      \
-			} while (0)
 # define ARGCHECK(s, format)						      \
   do									      \
     {									      \
@@ -134,10 +129,6 @@
 			  __set_errno (ENOMEM);				      \
 			  return EOF;					      \
 			} while (0)
-# define fmt_error()	do {						      \
-			  funlockfile (s);				      \
-			  return EOF;					      \
-			} while (0)
 # define ARGCHECK(s, format)						      \
   do									      \
     {									      \
@@ -1259,7 +1250,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
 
 	default:
 	  /* If this is an unknown format character punt.  */
-	  fmt_error ();
+	  conv_error ();
 	}
     }