lkml.org 
[lkml]   [2012]   [Jun]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 3.5.rc2 tty buffering bug ?
On Thu, Jun 14, 2012 at 12:13:31PM -0400, Dave Jones wrote:

> #include <stdio.h>
>
> void main()
> {
> printf("begin\n");
>
> if (fork() != 0)
> printf("child\n");
> else
> printf("parent\n");
>
> printf("end\n");
> }
>
> How does 'begin' get printed a second time ?

Someone pointed out that an fflush is needed before the fork.
Somehow I've managed to go all these years without knowing that.

Dave




\
 
 \ /
  Last update: 2012-06-14 19:01    [W:0.035 / U:1.396 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site