From: Linus Torvalds <torvalds@linux-foundation.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: Anders Melchiorsen <mail@cup.kalibalik.dk>, git@vger.kernel.org
Subject: Re: [PATCH] Use line buffering for standard output
Date: Sun, 3 Aug 2008 22:50:44 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.1.10.0808032241260.3668@nehalem.linux-foundation.org> (raw)
In-Reply-To: <7vej557hlq.fsf@gitster.siamese.dyndns.org>
On Sun, 3 Aug 2008, Junio C Hamano wrote:
> Anders Melchiorsen <mail@cup.kalibalik.dk> writes:
> >
> > #ifndef __MINGW32__
> > + /* Flush output before fork() to avoid cloning the buffer */
> > + fflush(stdout);
> > +
> > async->pid = fork();
> > if (async->pid < 0) {
> > error("fork (async) failed: %s", strerror(errno));
>
> I think this with s/stdout/NULL/ would be a reasonable thing to do.
Agreed, I think that's the right thing to do.
There's another fork there in start_command(), I suspect we should do it
there too: it's a "generic" path, so it should try to be safe.
The other ones look ok from a quick scan. I don't know the imap-send.c
code, but it's from outside people who hopefully know what they were
doing. The other ones don't seem to be using stdio before the fork (except
for things like "die()" ;)
There is a "fork()" in a _comment_ in builtin-ls-tree.c, and that one
definitely should have a fflush(NULL) in front of it. But it _is_ just a
comment, and rather than addign a fflush() there, it would probably be
better to turn it into a "start_command()" or something like that.
Linus.
next prev parent reply other threads:[~2008-08-04 5:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-03 21:26 [PATCH] Use line buffering for standard output Anders Melchiorsen
2008-08-03 21:38 ` Junio C Hamano
2008-08-03 21:46 ` Linus Torvalds
2008-08-03 22:48 ` Anders Melchiorsen
2008-08-04 0:24 ` Junio C Hamano
2008-08-04 0:30 ` [PATCH] Flush output in start_async Anders Melchiorsen
2008-08-04 5:50 ` Linus Torvalds [this message]
2008-08-04 10:18 ` [PATCH] Add output flushing before fork() Anders Melchiorsen
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=alpine.LFD.1.10.0808032241260.3668@nehalem.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=mail@cup.kalibalik.dk \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.