From: Jean-Frederic Clere Date: Thu, 3 Aug 2006 15:56:20 +0000 (+0000) Subject: Use a global pool for global pool. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa6fd6f3f3f3cd73b75b8fc0534986ee5172b80d;p=thirdparty%2Fapache%2Fhttpd.git Use a global pool for global pool. Remove the file containing the slotmems if its size has changed. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/httpd-proxy-scoreboard@428435 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/mem/mod_sharedmem.c b/modules/mem/mod_sharedmem.c index a41d62656d7..cb8f0c1fa72 100644 --- a/modules/mem/mod_sharedmem.c +++ b/modules/mem/mod_sharedmem.c @@ -40,7 +40,16 @@ static int initialize_cleanup(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp static int pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp) { - sharedmem_initglobalpool(p); + apr_pool_t *global_pool; + apr_status_t rv; + + rv = apr_pool_create(&global_pool, NULL); + if (rv != APR_SUCCESS) { + ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, + "Fatal error: unable to create global pool for shared slotmem"); + return rv; + } + sharedmem_initglobalpool(global_pool); return OK; } diff --git a/modules/mem/sharedmem_util.c b/modules/mem/sharedmem_util.c index 79adff7fa28..b03cbf35eae 100644 --- a/modules/mem/sharedmem_util.c +++ b/modules/mem/sharedmem_util.c @@ -110,6 +110,10 @@ void restore_slotmem(void *ptr, const char *name, apr_size_t item_size, int item if (apr_file_info_get(&fi, APR_FINFO_SIZE, fp) == APR_SUCCESS) { if (fi.size == nbytes) { apr_file_read(fp, ptr, &nbytes); + } else { + apr_file_close(fp); + apr_file_remove(storename, pool); + return; } } apr_file_close(fp);