httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bnicho...@apache.org
Subject svn commit: r386477 - /httpd/httpd/trunk/modules/ldap/util_ldap.c
Date Thu, 16 Mar 2006 23:03:00 GMT
Author: bnicholes
Date: Thu Mar 16 15:02:57 2006
New Revision: 386477

URL: http://svn.apache.org/viewcvs?rev=386477&view=rev
Log:
remove the race condition when creating the connection pool mutex.  Also eliminate some unnecessary
uses of the global memory pool

Modified:
    httpd/httpd/trunk/modules/ldap/util_ldap.c

Modified: httpd/httpd/trunk/modules/ldap/util_ldap.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/ldap/util_ldap.c?rev=386477&r1=386476&r2=386477&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ldap/util_ldap.c (original)
+++ httpd/httpd/trunk/modules/ldap/util_ldap.c Thu Mar 16 15:02:57 2006
@@ -439,10 +439,6 @@
 
 #if APR_HAS_THREADS
     /* mutex lock this function */
-    if (!st->mutex) {
-        apr_thread_mutex_create(&st->mutex, APR_THREAD_MUTEX_DEFAULT,
-                                st->pool);
-    }
     apr_thread_mutex_lock(st->mutex);
 #endif
 
@@ -1200,7 +1196,7 @@
 
     /* Grab the dn, copy it into the pool, and free it again */
     dn = ldap_get_dn(ldc->ldap, entry);
-    *binddn = apr_pstrdup(st->pool, dn);
+    *binddn = apr_pstrdup(r->pool, dn);
     ldap_memfree(dn);
 
     /*
@@ -1727,7 +1723,11 @@
     util_ldap_state_t *st =
         (util_ldap_state_t *)apr_pcalloc(p, sizeof(util_ldap_state_t));
 
-    st->pool = p;
+    /* Create a pool for mod_ldap to use */
+    apr_pool_create(&st->pool, p);
+#if APR_HAS_THREADS
+    apr_thread_mutex_create(&st->mutex, APR_THREAD_MUTEX_DEFAULT, st->pool);
+#endif
 
     st->cache_bytes = 100000;
     st->search_cache_ttl = 600000000;
@@ -1753,7 +1753,10 @@
     util_ldap_state_t *base = (util_ldap_state_t *) basev;
     util_ldap_state_t *overrides = (util_ldap_state_t *) overridesv;
 
-    st->pool = p;
+    st->pool = base->pool;
+#if APR_HAS_THREADS
+    st->mutex = base->mutex;
+#endif
 
     st->cache_bytes = base->cache_bytes;
     st->search_cache_ttl = base->search_cache_ttl;
@@ -1815,7 +1818,7 @@
         /* If the cache file already exists then delete it.  Otherwise we are
          * going to run into problems creating the shared memory. */
         if (st->cache_file) {
-            char *lck_file = apr_pstrcat(st->pool, st->cache_file, ".lck",
+            char *lck_file = apr_pstrcat(ptemp, st->cache_file, ".lck",
                                          NULL);
             apr_file_remove(lck_file, ptemp);
         }



Mime
View raw message