if (st->cache_file) {
char *lck_file = apr_pstrcat(st->pool, st->cache_file, ".lck",
NULL);
- apr_file_remove(st->cache_file, ptemp);
apr_file_remove(lck_file, ptemp);
}
#endif
if (st->cache_shm != NULL) {
apr_status_t result = apr_shm_destroy(st->cache_shm);
st->cache_shm = NULL;
- if (st->cache_file) {
- apr_file_remove(st->cache_file, st->pool);
- }
return result;
}
#endif
apr_status_t result;
apr_size_t size;
+ /* Remove any existing shm segment with this name. */
+ apr_shm_remove(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) {
- /*
- * 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(&st->cache_shm, st->cache_file, st->pool);
- }
if (result != APR_SUCCESS) {
return result;
}