From a11b86ee6312d60bfb4c40fd736b5282a9825075 Mon Sep 17 00:00:00 2001 From: Ruediger Pluem Date: Wed, 29 Mar 2006 06:53:51 +0000 Subject: * Check return value of apr_bucket_read when storing the response body to disk. Delete already cached data if an error occurs. Submitted by: Brian Akins Reviewed by: Ruediger Pluem git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@389697 13f79535-47bb-0310-9956-ffa450edef68 --- modules/cache/mod_disk_cache.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'modules/cache/mod_disk_cache.c') diff --git a/modules/cache/mod_disk_cache.c b/modules/cache/mod_disk_cache.c index 79ed6f14b4..b1b8f9801d 100644 --- a/modules/cache/mod_disk_cache.c +++ b/modules/cache/mod_disk_cache.c @@ -984,7 +984,15 @@ static apr_status_t store_body(cache_handle_t *h, request_rec *r, { const char *str; apr_size_t length, written; - apr_bucket_read(e, &str, &length, APR_BLOCK_READ); + rv = apr_bucket_read(e, &str, &length, APR_BLOCK_READ); + if (rv != APR_SUCCESS) { + ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + "cache_disk: Error when reading bucket for URL %s", + h->cache_obj->key); + /* Remove the intermediate cache file and return non-APR_SUCCESS */ + file_cache_errorcleanup(dobj, r); + return APR_EGENERAL; + } rv = apr_file_write_full(dobj->tfd, str, length, &written); if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, -- cgit v1.2.3