[uClibc]Small bug with stdout [stdio.c]
Manuel Novoa III
mnovoa3 at bellsouth.net
Tue Feb 20 01:12:19 UTC 2001
On Mon, 19 Feb 2001, AVENARD,JEAN-YVES (HP-Australia,ex2) wrote:
> Well, the problem happened in the latest version of crt0.S which called
> __uClibc_main.c
>
> Changing stdio.c definitely fixed the problem with sash
Please run the following test program against uClibc with an unpatched stdio.c.
You can ignore the warning... that's just gcc complaining about %b in the
format string. %b is a uClibc extension for binary output of an unsigned int
and behaves somewhat like %x.
[mjn3 at mars mini]$ cat buf.c
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
int main(void)
{
printf("stdout->mode = %032b isatty(stdout->fd) = %d\n",
(unsigned) stdout->mode, isatty(stdout->fd));
return EXIT_SUCCESS;
}
[mjn3 at mars mini]$ gcc-uClibc-i386 -Wall buf.c && ./a.out && ./a.out | cat
buf.c: In function `main':
buf.c:8: warning: unknown conversion type character `b' in format
buf.c:8: warning: too many arguments for format
stdout->mode = 00000000000000000000000000100101 isatty(stdout->fd) = 1
stdout->mode = 00000000000000000000000000100100 isatty(stdout->fd) = 0
The last two bits of mode are the buffering mode. Note that stdout is line
buffered in the first case -- writing to a tty, but is fully buffered when
writing to the pipe.
If this isn't the output you get, then I would think that that either
1) __uClibc_main is not being run
2) __init_stdio is not being run
3) isatty is not working correctly
because you've said that actually initializing the buffering mode to line
buffering works.
Manuel
More information about the uClibc
mailing list