diff options
author | obrien <obrien@FreeBSD.org> | 1998-09-25 12:20:27 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 1998-09-25 12:20:27 +0000 |
commit | a0e1ce12841f9c83845521c5170730188ee361a9 (patch) | |
tree | 1e22935116d66a0b3128cfabba1c08a61e1b39e2 /lib/libc/stdio/vfscanf.c | |
parent | 2ceab1cc66f914d2f5b3a70c730757c6599eb2e1 (diff) | |
download | FreeBSD-src-a0e1ce12841f9c83845521c5170730188ee361a9.zip FreeBSD-src-a0e1ce12841f9c83845521c5170730188ee361a9.tar.gz |
Apply patch to properly sscanf(3) when there is whitespace in the format
string. From the submitted patch:
Credit for patch: Chris Torek <torek@bsdi.com>
Tod Miller <millert@openbsd.org>
This makes us in line with SunOS 4.1.3_U1, Solaris 2.6, OpenBSD 2.3,
HP-UX 10.20, Irix 5.3. The previous behavior was in line with Ultrix 4.4.
PR: bin/7970
Submitted by: Niall Smart nialls@euristix.ie
Diffstat (limited to 'lib/libc/stdio/vfscanf.c')
-rw-r--r-- | lib/libc/stdio/vfscanf.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/libc/stdio/vfscanf.c b/lib/libc/stdio/vfscanf.c index ba4be5c..95e8701 100644 --- a/lib/libc/stdio/vfscanf.c +++ b/lib/libc/stdio/vfscanf.c @@ -39,7 +39,7 @@ static char sccsid[] = "@(#)vfscanf.c 8.1 (Berkeley) 6/4/93"; #endif static const char rcsid[] = - "$Id: vfscanf.c,v 1.11 1997/07/01 17:46:39 jkh Exp $"; + "$Id: vfscanf.c,v 1.12 1997/11/23 06:02:47 bde Exp $"; #endif /* LIBC_SCCS and not lint */ #include <stdio.h> @@ -137,13 +137,8 @@ __svfscanf(fp, fmt0, ap) if (c == 0) return (nassigned); if (isspace(c)) { - for (;;) { - if (fp->_r <= 0 && __srefill(fp)) - goto input_failure; - if (!isspace(*fp->_p)) - break; + while ((fp->_r > 0 || __srefill(fp) == 0) && isspace(*fp->_p)) nread++, fp->_r--, fp->_p++; - } continue; } if (c != '%') |