public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Jones <davej@redhat.com>
To: Linux Kernel <linux-kernel@vger.kernel.org>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: 3.5.rc2 tty buffering bug ?
Date: Thu, 14 Jun 2012 12:22:57 -0400	[thread overview]
Message-ID: <20120614162257.GA5238@redhat.com> (raw)
In-Reply-To: <20120614161331.GA29687@redhat.com>

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

 

  reply	other threads:[~2012-06-14 16:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-14 16:13 3.5.rc2 tty buffering bug ? Dave Jones
2012-06-14 16:22 ` Dave Jones [this message]
2012-06-14 16:30 ` Andreas Schwab
2012-06-14 16:41 ` Alan Cox
2012-06-15 10:32 ` Cong Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120614162257.GA5238@redhat.com \
    --to=davej@redhat.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox