From f2cfcea924cd8afbee66ffd03878d03e20e4a37a Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Fri, 27 Jun 2008 22:06:09 +0000 Subject: Fix problem on FreeBSD with 'file already exists' when creating shared lock. --- apache2x/mod_httpauth.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'apache2x/mod_httpauth.c') 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; } } -- cgit v1.2.3