summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2008-06-27 22:06:09 +0000
committerStef Walter <stef@memberwebs.com>2008-06-27 22:06:09 +0000
commitf2cfcea924cd8afbee66ffd03878d03e20e4a37a (patch)
tree4923626f8fd66d5dd0dc6e607fe3f4f9dbca2fa0
parent383054a85d48f1b7585bdabe7abc71f9668f01b6 (diff)
Fix problem on FreeBSD with 'file already exists' when creating shared lock.
-rw-r--r--apache2x/mod_httpauth.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/apache2x/mod_httpauth.c b/apache2x/mod_httpauth.c
index aac94eb..248dff5 100644
--- a/apache2x/mod_httpauth.c
+++ b/apache2x/mod_httpauth.c
@@ -154,6 +154,9 @@ httpauth_initialize (apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_
"httpauth: couldn't create temporary file: %s", lock_name);
}
+ if (file != NULL)
+ apr_file_close (file);
+
if (rc == APR_SUCCESS) {
rc = apr_global_mutex_create (&shared_lock, lock_name, APR_LOCK_DEFAULT, p);
if (rc != APR_SUCCESS)
@@ -161,9 +164,8 @@ httpauth_initialize (apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_
"httpauth: couldn't create shared memory lock: %s", lock_name);
}
- if (file != NULL)
- apr_file_close (file);
- shared_lock_name = lock_name;
+ if (rc == APR_SUCCESS)
+ shared_lock_name = lock_name;
return OK;
}
@@ -173,13 +175,13 @@ httpauth_child (apr_pool_t *p, server_rec *s)
{
apr_status_t rc;
- if (!shared_lock)
+ if (!shared_lock || !shared_lock_name)
return;
rc = apr_global_mutex_child_init (&shared_lock, shared_lock_name, p);
if (rc != APR_SUCCESS) {
ap_log_error (APLOG_MARK, APLOG_ERR, rc, s,
- "httpauth: couldn't create lock for shared memory in child");
+ "httpauth: couldn't create lock for shared memory in child: %s", shared_lock_name);
shared_lock = NULL;
}
}