Subject: Re: possible libc bug...
To: John Franklin <firstname.lastname@example.org>
From: Chris Pinnock <email@example.com>
Date: 04/06/2004 10:28:28
On Mon, Apr 05, 2004 at 10:47:23AM -0400, John Franklin wrote:
> IMHO, this is a bug. However, I see it happen on Linux and NetBSD. I
> have a sneaking suspicion that it'll happen on other *NIX boxes as well.
> Question: What should be the output of the following program?
> #include <stdio.h>
> #include <sys/types.h>
> #include <unistd.h>
> int main()
> printf("This will be buffered\n");
> printf("This will also be buffered.");
> return 0;
> I would expect:
> % ./fbt
> This will be buffered
> This will also be buffered%
No, (depending on the libc implementation of course - i.e. when buffers
are flushed) I would expect two "This will also be buffered" on the terminal.
The output buffers get copied to the child's space at fork time (or something
(I've been asked this "what happens when you run this code" question