diff options
author | trawick <trawick@13f79535-47bb-0310-9956-ffa450edef68> | 2000-06-03 03:24:38 +0000 |
---|---|---|
committer | trawick <trawick@13f79535-47bb-0310-9956-ffa450edef68> | 2000-06-03 03:24:38 +0000 |
commit | 2fa882981293319e873a53ee169123f8034e9053 (patch) | |
tree | 9edafc095572ea6bb1a51535670125cdc1f62b2c | |
parent | a4b89d0aff67a491c9ff8b5499b039e15a88c163 (diff) | |
download | libapr-2fa882981293319e873a53ee169123f8034e9053.tar.gz |
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: http://svn.apache.org/repos/asf/apr/apr/trunk@60134 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | locks/unix/crossproc.c | 18 | ||||
-rw-r--r-- | locks/unix/locks.c | 6 |
2 files changed, 15 insertions, 9 deletions
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 |