Fix handling of %l[].
authordrepper <drepper>
Wed, 22 Aug 2001 18:29:02 +0000 (18:29 +0000)
committerdrepper <drepper>
Wed, 22 Aug 2001 18:29:02 +0000 (18:29 +0000)
stdio-common/vfscanf.c

index 3c5bccb..4dc9cfe 100644 (file)
@@ -2090,19 +2090,18 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
                      size_t n;
 
                      /* Convert it into a wide character.  */
-                     n = __mbrtowc (wstr, buf, cnt, &cstate);
+                     buf[0] = c;
+                     n = __mbrtowc (wstr, buf, 1, &cstate);
 
                      if (n == (size_t) -2)
                        {
                          /* Possibly correct character, just not enough
                             input.  */
+                         ++cnt;
                          assert (cnt < MB_CUR_MAX);
                          continue;
                        }
 
-                     if (n != cnt)
-                       encode_error ();
-
                      ++wstr;
                      if ((flags & MALLOC)
                          && wstr == (wchar_t *) *strptr + strsize)