[uClibc]buglet in `tinylogin' with new uClibc stdio

Manuel Novoa III mjn3 at codepoet.org
Wed Mar 13 14:42:31 UTC 2002


Miles,

On Wed, Mar 13, 2002 at 10:28:36PM +0900, Miles Bader wrote:
> mjn3 at codepoet.org (Manuel Novoa III) writes:
> > The buffer mode initialization of stdin/stdout was incorrect.  Sorry.
> > I just fixed and tested it.  I had changed the default static init
> > from FBF to LBF at some point and forgotten to adjust _stdio_init().
> 
> I'm not sure what you're saying -- do you mean that it (the new stdio)
> defaults to line-buffered, but it wasn't getting initialized correctly?

stdin, stdout, and stderr are staticly allocated, and are set to
line-buffered, line-buffered, and non-buffered when they are
initialized.  If/when _stdio_init() is called, it changes the buffering
modes of stdin and/or stdout to fully buffered if they aren't ttys.

Of course, if stdio is built without buffering enabled, the buffering
flags are pretty meaningless.  That's ok, as there is no standard way
for an app to determine the type of buffering being used.
 
The standards only require that stderr not be fully buffered, and that
stdin and stdout be fully buffered if and only if they refer to a
non-interactive device.

> [Even if so, I guess it's a good idea to keep the fflush in tinylogin,
> though -- no reason to make things break for those people wacky enough
> to use a non-newline-terminated /etc/motd...]

Sure.  In fact, I 'talk'ed with Erik a few minutes before I commited the
stdio fix, and we came to the same conclusion about the fflush in
tinylogin.

Sorry again for the stdio bug.  That's definitely one I should have
caught.

Manuel



More information about the uClibc mailing list