From 532425808a7db140c4534458b5baef611efba10f Mon Sep 17 00:00:00 2001 From: Jim Jagielski Date: Wed, 12 Dec 2012 16:52:34 +0000 Subject: [PATCH] Merge r1405856 from trunk: * 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. Submitted by: rpluem Reviewed/backported by: jim git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1420827 13f79535-47bb-0310-9956-ffa450edef68 --- STATUS | 5 ----- modules/cache/mod_cache_disk.c | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/STATUS b/STATUS index b080127b78..2f773ce4ac 100644 --- a/STATUS +++ b/STATUS @@ -91,11 +91,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - * mod_cache_disk: Fix "...rename tempfile to datafile failed...") on Windows. - PR38827. - trunk patch: http://svn.apache.org/viewvc?rev=1405856&view=rev - 2.4.x patch: http://people.apache.org/~covener/patches/httpd-2.4.x-disk-cache-win.diff - +1 covener, rjung, jim PATCHES PROPOSED TO BACKPORT FROM TRUNK: diff --git a/modules/cache/mod_cache_disk.c b/modules/cache/mod_cache_disk.c index 0c65c1720e..ab8429fc61 100644 --- a/modules/cache/mod_cache_disk.c +++ b/modules/cache/mod_cache_disk.c @@ -594,8 +594,26 @@ 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; + + 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; return OK; -- 2.40.0