Re: [PATCH] Use line buffering for standard output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Sun, 3 Aug 2008, Junio C Hamano wrote:

> Anders Melchiorsen <mail@xxxxxxxxxxxxxxxx> 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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux