public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* 3.5.rc2 tty buffering bug ?
@ 2012-06-14 16:13 Dave Jones
  2012-06-14 16:22 ` Dave Jones
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Dave Jones @ 2012-06-14 16:13 UTC (permalink / raw)
  To: Linux Kernel; +Cc: Alan Cox

I found something odd that happens with redirection.

this code...



#include <stdio.h>

void main()
{
	printf("begin\n");

	if (fork() != 0)
		printf("child\n");
	else
		printf("parent\n");

	printf("end\n");
}

usually exits before the child gets to print anything, so stdout looks like..

begin
parent
end

but when redirected to a file, sometimes it prints what we expect, but other times
(if the child exits first) it seems to print..

begin
child
end
begin
parent
end


How does 'begin' get printed a second time ?

	Dave


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-06-15 10:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-14 16:13 3.5.rc2 tty buffering bug ? Dave Jones
2012-06-14 16:22 ` Dave Jones
2012-06-14 16:30 ` Andreas Schwab
2012-06-14 16:41 ` Alan Cox
2012-06-15 10:32 ` Cong Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox