summaryrefslogtreecommitdiff
path: root/libc/stdio/scanf.c
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2003-07-17 16:07:48 +0000
committerManuel Novoa III <mjn3@codepoet.org>2003-07-17 16:07:48 +0000
commit7247787b5029fc53a58751ca299b92a7cd96537a (patch)
tree66c472a1cbef13395394d1a3933f1d7bee2b3642 /libc/stdio/scanf.c
parent654b5ef1061619193ac07ef247dad1faf790b793 (diff)
Bug fix from Peter Kjellerstedt <peter.kjellerstedt@axis.com>. vfscanf was
not setting the FILE bufread member to flag the end of the buffer. Also, do not set bufgetc member if getc macro support is disabled.
Diffstat (limited to 'libc/stdio/scanf.c')
-rw-r--r--libc/stdio/scanf.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libc/stdio/scanf.c b/libc/stdio/scanf.c
index 48d53c7f3..9ac3d3c9c 100644
--- a/libc/stdio/scanf.c
+++ b/libc/stdio/scanf.c
@@ -35,6 +35,11 @@
*
* May 15, 2003
* Hopefully fix handling of 0 bytes with %s, %c, and %[ specifiers.
+ *
+ * July 17, 2003
+ * Bug fix from Peter Kjellerstedt <peter.kjellerstedt@axis.com>. vfscanf was
+ * not setting the FILE bufread member to flag the end of the buffer.
+ * Also, do not set bufgetc member if getc macro support is disabled.
*/
#define _ISOC99_SOURCE /* for LLONG_MAX primarily... */
@@ -128,7 +133,10 @@ int vsscanf(__const char *sp, __const char *fmt, va_list ap)
string->filedes = -2;
string->modeflags = (__FLAG_NARROW|__FLAG_READONLY);
string->bufstart = string->bufpos = (unsigned char *) ((void *) sp);
- string->bufgetc = string->bufstart + strlen(sp);
+#ifdef __STDIO_GETC_MACRO
+ string->bufgetc =
+#endif /* __STDIO_GETC_MACRO */
+ string->bufread = string->bufstart + strlen(sp);
#ifdef __STDIO_MBSTATE
__INIT_MBSTATE(&(string->state));