diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1998-01-20 21:25:40 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1998-01-20 21:25:40 +0000 |
commit | fa147bb915ca1b9aaa036f9aff23d66456ebed96 (patch) | |
tree | c8514660f268990072bd6b86379fc5193e419a43 /lib | |
parent | 61a03268f8860b645b407a51bb8eb22643dad75b (diff) |
Better fix for %n and whitespace. Chris Torek <torek@bsdi.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/stdio/vfscanf.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/lib/libc/stdio/vfscanf.c b/lib/libc/stdio/vfscanf.c index 64768bb8cc7..0a39d8fd0e4 100644 --- a/lib/libc/stdio/vfscanf.c +++ b/lib/libc/stdio/vfscanf.c @@ -35,7 +35,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: vfscanf.c,v 1.5 1998/01/19 19:40:12 millert Exp $"; +static char rcsid[] = "$OpenBSD: vfscanf.c,v 1.6 1998/01/20 21:25:39 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include <stdio.h> @@ -128,18 +128,9 @@ __svfscanf(fp, fmt0, ap) if (c == 0) return (nassigned); if (isspace(c)) { - for (;;) { - if (fp->_r <= 0 && __srefill(fp)) { - while (isspace(*fmt)) - fmt++; - if (*fmt == '%' && *(fmt + 1) == 'n') - break; - return (nassigned); - } - if (!isspace(*fp->_p)) - break; + while ((fp->_r > 0 || __srefill(fp) == 0) && + isspace(*fp->_p)) nread++, fp->_r--, fp->_p++; - } continue; } if (c != '%') |