summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES10
-rw-r--r--locks/unix/proc_mutex.c11
2 files changed, 14 insertions, 7 deletions
diff --git a/CHANGES b/CHANGES
index e30f1d185..8cce8100f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,15 @@
Changes with APR 0.9.4
+ *) When using a temporary file for flock- and fcntl-based mutexes,
+ don't let the file be deleted on close. For flock-based mutexes,
+ this corrects a fatal problem, since the file would disappear
+ when a program was spawned and cleanup-for-exec was performed,
+ and a subsequent attempt to perform child process mutex
+ initialization would fail. For fcntl-based mutexes, this was a
+ very minor issue that resulted in a failing unlink() when the
+ file was closed, since fcntl lock initialization always removes
+ the file immediately. [Jeff Trawick]
+
*) When writing to pipes with a timeout set, handle the situation
where the kernel says the pipe is writable but an attempt to
write <= PIPE_BUF bytes gets EAGAIN. APR will now write whatever
diff --git a/locks/unix/proc_mutex.c b/locks/unix/proc_mutex.c
index 0a98e81f2..1ad35de4a 100644
--- a/locks/unix/proc_mutex.c
+++ b/locks/unix/proc_mutex.c
@@ -516,7 +516,8 @@ static apr_status_t proc_mutex_fcntl_create(apr_proc_mutex_t *new_mutex,
}
else {
new_mutex->fname = apr_pstrdup(new_mutex->pool, "/tmp/aprXXXXXX");
- rv = apr_file_mktemp(&new_mutex->interproc, new_mutex->fname, 0,
+ rv = apr_file_mktemp(&new_mutex->interproc, new_mutex->fname,
+ APR_CREATE | APR_WRITE | APR_EXCL,
new_mutex->pool);
}
@@ -526,11 +527,6 @@ static apr_status_t proc_mutex_fcntl_create(apr_proc_mutex_t *new_mutex,
}
new_mutex->curr_locked = 0;
- /* XXX currently, apr_file_mktemp() always specifies that the file should
- * be removed when closed; that unlink() will fail since we're
- * removing it here; we want to remove it here since we don't need
- * it visible and we want it cleaned up if we exit catastrophically
- */
unlink(new_mutex->fname);
apr_pool_cleanup_register(new_mutex->pool,
(void*)new_mutex,
@@ -631,7 +627,8 @@ static apr_status_t proc_mutex_flock_create(apr_proc_mutex_t *new_mutex,
}
else {
new_mutex->fname = apr_pstrdup(new_mutex->pool, "/tmp/aprXXXXXX");
- rv = apr_file_mktemp(&new_mutex->interproc, new_mutex->fname, 0,
+ rv = apr_file_mktemp(&new_mutex->interproc, new_mutex->fname,
+ APR_CREATE | APR_WRITE | APR_EXCL,
new_mutex->pool);
}