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?

--Cliff


--------------------------------------------------------------
   Cliff Woolley
   [EMAIL PROTECTED]
   Charlottesville, VA


Reply via email to