From 8960c2a5edce96b5ea8e6db942b73e6649441f90 Mon Sep 17 00:00:00 2001 From: Manuel Novoa III Date: Wed, 17 Jan 2001 17:40:47 +0000 Subject: Fix static buffer used initialization for FIXED_BUFFERS > 2. --- libc/stdio/stdio.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'libc/stdio/stdio.c') diff --git a/libc/stdio/stdio.c b/libc/stdio/stdio.c index 32f4b925b..840bcf6ec 100644 --- a/libc/stdio/stdio.c +++ b/libc/stdio/stdio.c @@ -33,7 +33,7 @@ extern FILE *__IO_list; /* For fflush at exit */ #define FIXED_BUFFERS 2 struct fixed_buffer { unsigned char data[BUFSIZ]; - int used; + unsigned char used; }; extern struct fixed_buffer _fixed_buffers[FIXED_BUFFERS]; @@ -96,7 +96,7 @@ FILE _stdio_streams[3] = { }; /* - * Note: the following forces lining of the __init_stdio function if + * Note: the following forces linking of the __init_stdio function if * any of the stdio functions are used (except perror) since they all * call fflush directly or indirectly. */ @@ -121,13 +121,22 @@ void __stdio_close_all(void) void __init_stdio(void) { +#if FIXED_BUFFERS > 2 + int i; + + for ( i = 2 ; i < FIXED_BUFFERS ; i++ ) { + _fixed_buffers[i].used = 0; + } +#endif + _fixed_buffers[0].used = 1; _fixed_buffers[1].used = 1; - if (isatty(1)) + if (isatty(1)) { stdout->mode |= _IOLBF; + } #if 0 - /* taken care of in _start.c and exit.c now*/ + /* Taken care of in _start.S and atexit.c now. */ atexit(__stdio_close_all); #endif } -- cgit v1.2.3