From 217f85db5502d1e01ddae42412780831d8ac59ad Mon Sep 17 00:00:00 2001 From: Jeff Trawick Date: Sat, 3 Jun 2000 03:24:38 +0000 Subject: fix problems in recent change to use mkstemp(); also, fix not-so-recent bug in flock support (destroy_inter_lock was renamed to ap_unix_destroy_inter_lock) git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@60134 13f79535-47bb-0310-9956-ffa450edef68 --- locks/unix/crossproc.c | 18 +++++++++++++++--- locks/unix/locks.c | 6 ------ 2 files changed, 15 insertions(+), 9 deletions(-) (limited to 'locks') diff --git a/locks/unix/crossproc.c b/locks/unix/crossproc.c index cddd80f4a..b96b11bdc 100644 --- a/locks/unix/crossproc.c +++ b/locks/unix/crossproc.c @@ -269,7 +269,13 @@ static ap_status_t lock_cleanup(void *lock_) ap_status_t ap_unix_create_inter_lock(ap_lock_t *new) { - new->interproc = open(new->fname, O_CREAT | O_WRONLY | O_EXCL, 0644); + if (new->fname) { + new->interproc = open(new->fname, O_CREAT | O_WRONLY | O_EXCL, 0644); + } + else { + new->fname = ap_pstrdup(new->cntxt, "/tmp/aprXXXXXX"); + new->interproc = mkstemp(new->fname); + } if (new->interproc < 0) { lock_cleanup(new); @@ -338,7 +344,13 @@ static ap_status_t lock_cleanup(void *lock_) ap_status_t ap_unix_create_inter_lock(ap_lock_t *new) { - new->interproc = open(new->fname, O_CREAT | O_WRONLY | O_EXCL, 0600); + if (new->fname) { + new->interproc = open(new->fname, O_CREAT | O_WRONLY | O_EXCL, 0644); + } + else { + new->fname = ap_pstrdup(new->cntxt, "/tmp/aprXXXXXX"); + new->interproc = mkstemp(new->fname); + } if (new->interproc < 0) { lock_cleanup(new); @@ -387,7 +399,7 @@ ap_status_t ap_unix_child_init_lock(ap_lock_t **lock, ap_pool_t *cont, new->fname = ap_pstrdup(cont, fname); new->interproc = open(new->fname, O_CREAT | O_WRONLY | O_EXCL, 0600); if (new->interproc == -1) { - destroy_inter_lock(new); + ap_unix_destroy_inter_lock(new); return errno; } return APR_SUCCESS; diff --git a/locks/unix/locks.c b/locks/unix/locks.c index 48de7a75d..8f34633d5 100644 --- a/locks/unix/locks.c +++ b/locks/unix/locks.c @@ -73,12 +73,6 @@ ap_status_t ap_create_lock(ap_lock_t **lock, ap_locktype_e type, if (fname != NULL) { new->fname = ap_pstrdup(cont, fname); } - else { - char *filename = "/tmp/aprXXXXXX"; - new->interproc = mkstemp(filename); - new->fname = ap_pstrdup(cont, filename); - unlink(new->fname); - } } #endif -- cgit v1.2.1