diff options
author | Jeff Trawick <trawick@apache.org> | 2000-06-03 03:24:38 +0000 |
---|---|---|
committer | Jeff Trawick <trawick@apache.org> | 2000-06-03 03:24:38 +0000 |
commit | 217f85db5502d1e01ddae42412780831d8ac59ad (patch) | |
tree | 9edafc095572ea6bb1a51535670125cdc1f62b2c /locks | |
parent | 21c2784d78882b396ba0335776e91296a6786d5e (diff) | |
download | apr-217f85db5502d1e01ddae42412780831d8ac59ad.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: https://svn.apache.org/repos/asf/apr/apr/trunk@60134 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'locks')
-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 |