From: Ruediger Pluem Date: Sun, 28 May 2006 10:32:01 +0000 (+0000) Subject: * Remove temporary files if renaming fails, otherwise they may accumulate. X-Git-Tag: 2.3.0~2377 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5450296c9aee0f7f87902e76b5b2357b516a26bc;p=thirdparty%2Fapache%2Fhttpd.git * Remove temporary files if renaming fails, otherwise they may accumulate. Submitted by: Davi Arnaut Reviewed by: rpluem git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@409942 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 8086806bce4..d5b66a3b84c 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,9 @@ Changes with Apache 2.3.0 [Remove entries to the current 2.0 and 2.2 section below, when backported] + *) mod_disk_cache: Delete temporary files if they cannot be renamed to their + final name. [Davi Arnaut ] + *) Worker MPM: On graceless shutdown or restart, send signals to each worker thread to wake them up if they're polling on a Keep-Alive connection. PR 38737. [Chris Darroch] diff --git a/modules/cache/mod_disk_cache.c b/modules/cache/mod_disk_cache.c index 56b9c68bd47..44a3279f467 100644 --- a/modules/cache/mod_disk_cache.c +++ b/modules/cache/mod_disk_cache.c @@ -165,7 +165,10 @@ static apr_status_t file_cache_el_final(disk_cache_object_t *dobj, */ rv = apr_file_rename(dobj->tempfile, dobj->datafile, r->pool); if (rv != APR_SUCCESS) { - /* XXX log */ + ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, r->server, + "disk_cache: rename tempfile to datafile failed:" + " %s -> %s", dobj->tempfile, dobj->datafile); + apr_file_remove(dobj->tempfile, r->pool); } dobj->tfd = NULL; @@ -854,6 +857,7 @@ static apr_status_t store_headers(cache_handle_t *h, request_rec *r, cache_info ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, r->server, "disk_cache: rename tempfile to varyfile failed: %s -> %s", dobj->tempfile, dobj->hdrsfile); + apr_file_remove(dobj->tempfile, r->pool); return rv; } @@ -946,6 +950,7 @@ static apr_status_t store_headers(cache_handle_t *h, request_rec *r, cache_info ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, "disk_cache: rename tempfile to hdrsfile failed: %s -> %s", dobj->tempfile, dobj->hdrsfile); + apr_file_remove(dobj->tempfile, r->pool); return rv; }