]> granicus.if.org Git - apache/commitdiff
* modules/cluster/mod_heartmonitor.c
authorPaul Querna <pquerna@apache.org>
Fri, 27 Mar 2009 13:27:44 +0000 (13:27 +0000)
committerPaul Querna <pquerna@apache.org>
Fri, 27 Mar 2009 13:27:44 +0000 (13:27 +0000)
  (hm_update_stats): Flush heartbeat file before closing, to make sure the file
    is always written correctly, and check for errors on flush or close.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@759131 13f79535-47bb-0310-9956-ffa450edef68

modules/cluster/mod_heartmonitor.c

index 77552587a8ae35a162e7a55cd70347b4a1577e00..bb5ab78f05968cfccb8bc3317274f54fb56572b6 100644 (file)
@@ -183,8 +183,20 @@ static apr_status_t hm_update_stats(hm_ctx_t *ctx, apr_pool_t *p)
         }
     }
 
-    apr_file_close(fp);
+    rv = apr_file_flush(fp);
+    if (rv) {
+      ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
+                   "Heartmonitor: Unable to flush file: %s", path);
+      return rv;
+    }
 
+    rv = apr_file_close(fp);
+    if (rv) {
+      ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
+                   "Heartmonitor: Unable to close file: %s", path);
+      return rv;
+    }
+  
     rv = apr_file_perms_set(path,
                             APR_FPROT_UREAD | APR_FPROT_GREAD |
                             APR_FPROT_WREAD);