Re: [PATCH] No temporary file left behind

2006-05-28 Thread Ruediger Pluem


On 05/28/2006 03:52 AM, Davi Arnaut wrote:
 Hi,
 
 Remove mod_disk_cache temporary files when rename() fails, otherwise
 they may accumulate in excess. 

Thanks for the patch. Committed to trunk as r409942 
(http://svn.apache.org/viewvc?rev=409942view=rev).

Regards

RĂ¼diger




[PATCH] No temporary file left behind

2006-05-27 Thread Davi Arnaut
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;
 }