On 17.05.2011 17:22, Daniel Shahaf wrote:
> Stefan Fuhrmann wrote on Tue, May 17, 2011 at 17:01:03 +0200:
>> On 17.05.2011 09:51, Daniel Shahaf wrote:
>>> stefan2_at_apache.org wrote on Mon, May 16, 2011 at 00:02:06 -0000:
>>>> Author: stefan2
>>>> Date: Mon May 16 00:02:05 2011
>>>> New Revision: 1103578
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=1103578&view=rev
>>>>
<snip>
>>>> + return svn_io_dir_close(dir);
>>> I'm not sure you're even allowed to call this if the previous calls
>>> returned an error. (The documentations are silent AFAICT.)
>> It is legal. If it would be illegal on the APR level, svn_io_dir_read
>> would need to be patched to close the handle after string conversion
>> failures as well.
>>
> Why is it legal?
>
> The APR docstring is silent, and the unix implementation just forwards
> to closedir(3) (whose manpage on my system is, too, silent).
Well, at that point in the code, opening the handle has succeeded.
It is only that some read access failed. There is no documentation
that states that the container handle itself would become invalid
(compare that to read / write failures to an open file). Hence, we can
assume that the handle can and should be closed explicitly.
Looking at the implementation makes clear that at the end of the
pool lifetime, the handle will be closed using the same methods
as the an explicit close.
-- Stefan^2.
Received on 2011-06-02 17:48:53 CEST