diff options
author | 1998-01-19 19:40:12 +0000 | |
---|---|---|
committer | 1998-01-19 19:40:12 +0000 | |
commit | 3c85dbe0b2d5a9e8ed2f69253fa8890182b7444c (patch) | |
tree | ab019e2ddf84b26730bd50e40496fc93e6f05da1 /lib/libc/stdio/vfscanf.c | |
parent | Fix wording. Thanks to austin@canuck.com (diff) | |
download | wireguard-openbsd-3c85dbe0b2d5a9e8ed2f69253fa8890182b7444c.tar.xz wireguard-openbsd-3c85dbe0b2d5a9e8ed2f69253fa8890182b7444c.zip |
Ignore whitespace separating a conversion and %n. There may be
a cleaner way to do this.
Diffstat (limited to 'lib/libc/stdio/vfscanf.c')
-rw-r--r-- | lib/libc/stdio/vfscanf.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/libc/stdio/vfscanf.c b/lib/libc/stdio/vfscanf.c index c0ad92062d4..64768bb8cc7 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.4 1997/07/25 20:30:13 mickey Exp $"; +static char rcsid[] = "$OpenBSD: vfscanf.c,v 1.5 1998/01/19 19:40:12 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include <stdio.h> @@ -129,8 +129,13 @@ __svfscanf(fp, fmt0, ap) return (nassigned); if (isspace(c)) { for (;;) { - if (fp->_r <= 0 && __srefill(fp)) + if (fp->_r <= 0 && __srefill(fp)) { + while (isspace(*fmt)) + fmt++; + if (*fmt == '%' && *(fmt + 1) == 'n') + break; return (nassigned); + } if (!isspace(*fp->_p)) break; nread++, fp->_r--, fp->_p++; |