From: Graham Leggett Date: Tue, 21 Jan 2003 10:46:57 +0000 (+0000) Subject: Fix mod_ldap to open an existing shared memory file should one X-Git-Tag: pre_ajp_proxy~2235 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ba6fad167161575bad75ad984ce7b4ebd464680a;p=apache Fix mod_ldap to open an existing shared memory file should one already exist. PR: 12757 Obtained from: Submitted by: Scooter Morris Reviewed by: Graham Leggett git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@98416 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 5ee2ea605d..e3161037b3 100644 --- a/CHANGES +++ b/CHANGES @@ -65,6 +65,10 @@ Changes with Apache 2.1.0-dev Changes with Apache 2.0.45 + *) Fix mod_ldap to open an existing shared memory file should one + already exist. PR 12757. [Scooter Morris , + Graham Leggett] + *) Fix the ulimit command used by apachectl on Tru64. PR 13609. [Joseph Senulis , Jeff Trawick] diff --git a/modules/experimental/util_ldap_cache.c b/modules/experimental/util_ldap_cache.c index 47b0ff17ae..79fc6bea33 100644 --- a/modules/experimental/util_ldap_cache.c +++ b/modules/experimental/util_ldap_cache.c @@ -66,7 +66,7 @@ #ifdef APU_HAS_LDAP - +#define MODLDAP_SHMEM_CACHE "/tmp/mod_ldap_cache" /* ------------------------------------------------------------------ */ @@ -295,7 +295,14 @@ apr_status_t util_ldap_cache_init(apr_pool_t *pool, apr_size_t reqsize) #if APR_HAS_SHARED_MEMORY apr_status_t result; - result = apr_shm_create(&util_ldap_shm, reqsize, "/tmp/ldap_cache", pool); + result = apr_shm_create(&util_ldap_shm, reqsize, MODLDAP_SHMEM_CACHE, pool); + if (result == EEXIST) { + /* + * The cache could have already been created (i.e. we may be a child process). See + * if we can attach to the existing shared memory + */ + result = apr_shm_attach(&util_ldap_shm, MODLDAP_SHMEM_CACHE, pool); + } if (result != APR_SUCCESS) { return result; }