diff options
author | trawick <trawick@13f79535-47bb-0310-9956-ffa450edef68> | 2003-04-19 02:33:13 +0000 |
---|---|---|
committer | trawick <trawick@13f79535-47bb-0310-9956-ffa450edef68> | 2003-04-19 02:33:13 +0000 |
commit | d8ba036e12e5b167efae0d6dae38caed40974a1e (patch) | |
tree | 841b119261e7252211fe289ddb8a8851d9ebddda | |
parent | b006f9a9b04aff3e9bc16db4566e00f66f9ce328 (diff) | |
download | libapr-d8ba036e12e5b167efae0d6dae38caed40974a1e.tar.gz |
Don't segfault trying to close a file in error paths of flock
and fcntl mutex creation.
PR: 19036
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@64488 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | CHANGES | 3 | ||||
-rw-r--r-- | locks/unix/proc_mutex.c | 9 |
2 files changed, 9 insertions, 3 deletions
@@ -1,5 +1,8 @@ Changes with APR 0.9.4 + *) Don't segfault trying to close a file in error paths of flock + and fcntl mutex creation. PR 19036 [Jeff Trawick] + *) Add %pT support to apr_snprintf() for printing an apr_os_thread_t. [Jeff Trawick] diff --git a/locks/unix/proc_mutex.c b/locks/unix/proc_mutex.c index 70bf7da80..0a98e81f2 100644 --- a/locks/unix/proc_mutex.c +++ b/locks/unix/proc_mutex.c @@ -496,8 +496,9 @@ static apr_status_t proc_mutex_fcntl_cleanup(void *mutex_) if (status != APR_SUCCESS) return status; } - apr_file_close(mutex->interproc); - + if (mutex->interproc) { /* if it was opened successfully */ + apr_file_close(mutex->interproc); + } return APR_SUCCESS; } @@ -609,7 +610,9 @@ static apr_status_t proc_mutex_flock_cleanup(void *mutex_) if (status != APR_SUCCESS) return status; } - apr_file_close(mutex->interproc); + if (mutex->interproc) { /* if it was opened properly */ + apr_file_close(mutex->interproc); + } unlink(mutex->fname); return APR_SUCCESS; } |