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 09:01:05 GMT
On Fri, Oct 16, 2009 at 10:54:13AM +0200, Mladen Turk wrote:
> On 16/10/09 10:39, Joe Orton wrote:
>>
>> 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.
>>
>
> I suppose it shouldn't crash the apr.
> IMO either second call to open should fail or
> the call to close should fail, but without actually calling the close().

I think the reporter meant "fail" when they said "crash".

I don't see any reason why it would crash on Unix: the first call to 
apr_file_close() will set fd->filedes to -1 after calling close(), the 
second one will call close(-1) and fail with EBADF.

Regards, Joe

Mime
View raw message