apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Bloom <...@covalent.net>
Subject Re: apr_file_close bug?
Date Mon, 01 Oct 2001 18:39:01 GMT
On Monday 01 October 2001 11:32 am, Cliff Woolley wrote:
> On Unix, apr_file_close looks like this:
>
> APR_DECLARE(apr_status_t) apr_file_close(apr_file_t *file)
> {
>     apr_status_t rv;
>
>     if ((rv = apr_unix_file_cleanup(file)) == APR_SUCCESS) {
>         apr_pool_cleanup_kill(file->cntxt, file, apr_unix_file_cleanup);
>         return APR_SUCCESS;
>     }
>     return rv;
> }
>
>
> So if file_cleanup fails, then we won't kill the cleanup, and when we
> cleanup the file->cntxt pool, we'll run the cleanup again.  We used to
> have this exact same behavior in the directory cleanups and it caused
> segfaults.
>
> I think it should just say this:
>
> {
>     apr_pool_cleanup_kill(file->cntxt, file, apr_unix_file_cleanup);
>     return apr_unix_file_cleanup(file);
> }
>
> Which is exactly equivalent to what apr_dir_close() does now that it's
> been fixed.  Thoughts?

++1!  In fact, all of the cleanups should do this.  I didn't know about
apr_pool_cleanup_kill when I wrote all of those functions.

Ryan

______________________________________________________________
Ryan Bloom				rbb@apache.org
Covalent Technologies			rbb@covalent.net
--------------------------------------------------------------

Mime
View raw message