[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

closing stdout (was: Re: CVS update: subversion/subversion/client diff.c)

From: Greg Stein <gstein_at_lyra.org>
Date: 2001-02-04 22:37:43 CET

On Sat, Jan 27, 2001 at 11:48:58AM -0500, Greg Hudson wrote:
> > OK, so why did I have to make this change? I mean, we went through
> > all this bother to convert stdout into an apr_file_t, but I'm not
> > supposed to apr_close() it when I'm done?
> I'm certainly not surprised; when you fdopen() a file descriptor, the
> resulting file handle "owns" the file descriptor and will close it
> when you fclose() the file handle. Same with APR and
> apr_put_os_file() or whatever it's called.
> This would be cleaner if apr_create_process had a better interface for
> "leave stdout alone." (Assuming it doesn't... if I recall correctly,
> you said that if outfile was NULL then stdout went nowhere.)

I think the right behaviour is to dup() the stdout descriptor, thus allowing
the file to be closed without problem.

Note that a pool cleanup closes a file. If you had done the allocation in a
subpool and then cleared it... bam! There goes the file.

Need to investigate some more, but I'll make a note of it in APR's STATUS


Greg Stein, http://www.lyra.org/
Received on Sat Oct 21 14:36:21 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.