summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortrawick <trawick@13f79535-47bb-0310-9956-ffa450edef68>2003-04-19 02:33:13 +0000
committertrawick <trawick@13f79535-47bb-0310-9956-ffa450edef68>2003-04-19 02:33:13 +0000
commitd8ba036e12e5b167efae0d6dae38caed40974a1e (patch)
tree841b119261e7252211fe289ddb8a8851d9ebddda
parentb006f9a9b04aff3e9bc16db4566e00f66f9ce328 (diff)
downloadlibapr-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--CHANGES3
-rw-r--r--locks/unix/proc_mutex.c9
2 files changed, 9 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index 4a22ff882..4cc983c1d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -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;
}