diff options
author | 1998-01-20 21:25:39 +0000 | |
---|---|---|
committer | 1998-01-20 21:25:39 +0000 | |
commit | 228caf8dbc856cfaa1d1fa7acfc41bfa2da1c236 (patch) | |
tree | 1bc25356fede4d8b6d03d7e109c8564a2cb90c43 /lib/libc/stdio | |
parent | manpage from ian@darwinsys.com (diff) | |
download | wireguard-openbsd-228caf8dbc856cfaa1d1fa7acfc41bfa2da1c236.tar.xz wireguard-openbsd-228caf8dbc856cfaa1d1fa7acfc41bfa2da1c236.zip |
Better fix for %n and whitespace. Chris Torek <torek@bsdi.com>
Diffstat (limited to 'lib/libc/stdio')
-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 != '%') |