mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
* modules/ldap/util_ldap_cache.c (util_ldap_cache_init): Use the
actual available size of the shm segment not the requested size. Ensure the requested size is aligned. Check errors from apr_rmm_init. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@225753 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -407,8 +407,11 @@ apr_status_t util_ldap_cache_init(apr_pool_t *pool, util_ldap_state_t *st)
|
|||||||
{
|
{
|
||||||
#if APR_HAS_SHARED_MEMORY
|
#if APR_HAS_SHARED_MEMORY
|
||||||
apr_status_t result;
|
apr_status_t result;
|
||||||
|
apr_size_t size;
|
||||||
|
|
||||||
result = apr_shm_create(&st->cache_shm, st->cache_bytes, st->cache_file, st->pool);
|
size = APR_ALIGN_DEFAULT(st->cache_bytes);
|
||||||
|
|
||||||
|
result = apr_shm_create(&st->cache_shm, size, st->cache_file, st->pool);
|
||||||
if (result == APR_EEXIST) {
|
if (result == APR_EEXIST) {
|
||||||
/*
|
/*
|
||||||
* The cache could have already been created (i.e. we may be a child process). See
|
* The cache could have already been created (i.e. we may be a child process). See
|
||||||
@@ -420,8 +423,17 @@ apr_status_t util_ldap_cache_init(apr_pool_t *pool, util_ldap_state_t *st)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Determine the usable size of the shm segment. */
|
||||||
|
size = apr_shm_size_get(st->cache_shm);
|
||||||
|
|
||||||
/* This will create a rmm "handler" to get into the shared memory area */
|
/* This will create a rmm "handler" to get into the shared memory area */
|
||||||
apr_rmm_init(&st->cache_rmm, NULL, (void *)apr_shm_baseaddr_get(st->cache_shm), st->cache_bytes, st->pool);
|
result = apr_rmm_init(&st->cache_rmm, NULL,
|
||||||
|
apr_shm_baseaddr_get(st->cache_shm), size,
|
||||||
|
st->pool);
|
||||||
|
if (result != APR_SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
apr_pool_cleanup_register(st->pool, st , util_ldap_cache_module_kill, apr_pool_cleanup_null);
|
apr_pool_cleanup_register(st->pool, st , util_ldap_cache_module_kill, apr_pool_cleanup_null);
|
||||||
|
Reference in New Issue
Block a user