diff options
| author | ylavic <ylavic@13f79535-47bb-0310-9956-ffa450edef68> | 2022-01-19 12:00:38 +0000 |
|---|---|---|
| committer | ylavic <ylavic@13f79535-47bb-0310-9956-ffa450edef68> | 2022-01-19 12:00:38 +0000 |
| commit | fdf36c29c4a3ac0f7c7433635ec52c4397ca814c (patch) | |
| tree | a35cd28a6092731b639177a68f31faa9446a97ae /threadproc/unix | |
| parent | 04dcabc8d6ddc69a215fd8e60a5a60d5fcee4b3c (diff) | |
| download | libapr-fdf36c29c4a3ac0f7c7433635ec52c4397ca814c.tar.gz | |
apr_thread: Follow up to r1897197: Safer apr_thread_join().
Make sure apr_thread_join() behaves correctly w.r.t. the returned value
and pool destroy for all archs.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897198 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'threadproc/unix')
| -rw-r--r-- | threadproc/unix/thread.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/threadproc/unix/thread.c b/threadproc/unix/thread.c index 3b6ef2809..d1ae872c6 100644 --- a/threadproc/unix/thread.c +++ b/threadproc/unix/thread.c @@ -235,24 +235,22 @@ APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval, apr_thread_t *thd) { apr_status_t stat; - apr_status_t *thread_stat; + void *thread_stat; if (thd->detached) { return APR_EINVAL; } - if ((stat = pthread_join(*thd->td,(void *)&thread_stat)) == 0) { - *retval = thd->exitval; - apr_pool_destroy(thd->pool); - return APR_SUCCESS; - } - else { + if ((stat = pthread_join(*thd->td, &thread_stat))) { #ifdef HAVE_ZOS_PTHREADS stat = errno; #endif - return stat; } + + *retval = thd->exitval; + apr_pool_destroy(thd->pool); + return APR_SUCCESS; } APR_DECLARE(apr_status_t) apr_thread_detach(apr_thread_t *thd) |
