apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Iain Wade" <iw...@optusnet.com.au>
Subject apr_os_dir_put fixes
Date Tue, 11 Dec 2007 13:24:07 GMT
Hi,

I believe the apr_os_dir_put function is a bit flawed as it stands.

It seems to support two behaviours:

a/ If it is passed a NULL pointer for a dir handle, it will allocate a
new object to use
b/ If it is passed an existing dir handle it will just replace the dirstruct.

In the first case however, it fails to allocate an entry buffer, setup
the cleanup handler, or register a dirname.

In the second case, you are left with a dirstruct which does not match
the dirname.

Without a correct dirname, it would seem the apr_stat-fill in
apr_read_dir will always fail because it would not be able to
construct the full path to the entry.

The apr_dir_t typedef is opaque, so fiddling the dirname after the
fact is not possible.

I have attached a patch which I would like you to consider, or I would
appreciate some alternate suggestions.

It has the drawback of altering the apr_os_dir_put() function to
accept an extra argument (dirname). I don't know your policy of stable
interfaces, but I haven't really been able to find any other users of
this call in my searching.

Regards,
--Iain

Mime
View raw message