From 7bf46033f327866deddfb15a6b4553a8f1b96d9e Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Mon, 19 Jan 1998 19:40:13 +0000 Subject: Ignore whitespace separating a conversion and %n. There may be a cleaner way to do this. --- lib/libc/stdio/vfscanf.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib/libc/stdio/vfscanf.c') 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 @@ -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++; -- cgit v1.2.3