apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Orton <jor...@redhat.com>
Subject Re: Crash in apr_file_close() (Linux)
Date Fri, 16 Oct 2009 08:39:49 GMT
On Fri, Oct 16, 2009 at 03:26:31PM +0700, Yuri V. Vishnevskiy wrote:
> Dear developers,
> For some reason in my program I need two file handlers of stdout stream.
> When I close these handlers I obtain an error on the second close: "Bad  
> file descriptor"

It seems like reasonable behaviour that the second apr_file_close() call 
should fail, though it certainly isn't obvious from reading the docs.  
How else do you expect it to behave?  You cannot close an fd twice.

If you want to be able to close the fds without closing stdout, then use 
apr_file_dup() to create the second handle to stdout.

Regards, Joe


Mime
View raw message