Hi,
Remove mod_disk_cache temporary files when rename() fails, otherwise
they may accumulate in excess.
--
Davi Arnaut
Index: modules/cache/mod_disk_cache.c
===
--- modules/cache/mod_disk_cache.c (revision 409900)
+++ modules/cache/mod_disk_cache.c (working copy)
@@ -165,7 +165,10 @@
*/
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 @@
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 @@
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;
}