You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Greg Stein <gs...@lyra.org> on 2001/02/04 21:37:43 UTC

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

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
file.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/