From effce3be5c42f32acdf3b484d0d8f6ce5758767e Mon Sep 17 00:00:00 2001 From: Ruediger Pluem Date: Mon, 5 Nov 2012 16:01:23 +0000 Subject: [PATCH] * fd is no member of disk_cache_object_t. Instead it is a member of disk_cache_file_t. Close all fd's (fd, tempfd) for all cache elements (hdrs, data, vary) if they are present. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1405856 13f79535-47bb-0310-9956-ffa450edef68 --- modules/cache/mod_cache_disk.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/modules/cache/mod_cache_disk.c b/modules/cache/mod_cache_disk.c index a024b7176fe..8427e8fd60f 100644 --- a/modules/cache/mod_cache_disk.c +++ b/modules/cache/mod_cache_disk.c @@ -594,12 +594,25 @@ static int open_entity(cache_handle_t *h, request_rec *r, const char *key) return DECLINED; } +static void close_disk_cache_fd(disk_cache_file_t *file) +{ + if (file->fd != NULL) { + apr_file_close(file->fd); + file->fd = NULL; + } + if (file->tempfd != NULL) { + apr_file_close(file->tempfd); + file->tempfd = NULL; + } +} + static int remove_entity(cache_handle_t *h) { disk_cache_object_t *dobj = (disk_cache_object_t *) h->cache_obj->vobj; - if (dobj->fd != NULL) { - apr_file_close(dobj->fd); - } + + close_disk_cache_fd(&(dobj->hdrs)); + close_disk_cache_fd(&(dobj->vary)); + close_disk_cache_fd(&(dobj->data)); /* Null out the cache object pointer so next time we start from scratch */ h->cache_obj = NULL; -- 2.47.3