diff options
author | Greg Stein <gstein@apache.org> | 2001-01-19 09:56:32 +0000 |
---|---|---|
committer | Greg Stein <gstein@apache.org> | 2001-01-19 09:56:32 +0000 |
commit | 7c974b0ce591c43aa112ff168dc357fd077dbc27 (patch) | |
tree | edc948fab9e2631d3387f6bba957088215327082 /dso/unix | |
parent | c9508c601b8e68d9162d4b95752c18072f0e1139 (diff) | |
download | apr-7c974b0ce591c43aa112ff168dc357fd077dbc27.tar.gz |
watch out for a double-unload. one manually from apr_dso_unload(), followed
by one through the pool cleanup.
1) protect the unload by setting/checking the handle to NULL
2) unload "runs" the cleanup to also remove it from the pool cleanup
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@61078 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dso/unix')
-rw-r--r-- | dso/unix/dso.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/dso/unix/dso.c b/dso/unix/dso.c index ada9c314f..25871f7ed 100644 --- a/dso/unix/dso.c +++ b/dso/unix/dso.c @@ -64,7 +64,19 @@ static apr_status_t dso_cleanup(void *thedso) { apr_dso_handle_t *dso = thedso; - return apr_dso_unload(dso); + + if (dso->handle == NULL) + return APR_SUCCESS; + +#if defined(HPUX) || defined(HPUX10) || defined(HPUX11) + shl_unload((shl_t)dso->handle); +#else + if (dlclose(dso->handle) != 0) + return APR_EINIT; +#endif + dso->handle = NULL; + + return APR_SUCCESS; } APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle, @@ -102,15 +114,7 @@ APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle, APR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle) { -#if defined(HPUX) || defined(HPUX10) || defined(HPUX11) - shl_unload((shl_t)handle->handle); -#else - if (dlclose(handle->handle) != 0) - return APR_EINIT; -#endif - handle->handle = NULL; - - return APR_SUCCESS; + return apr_run_cleanup(handle->cont, handle, dso_cleanup); } APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, |