From: Paul Querna Date: Fri, 27 Mar 2009 13:27:44 +0000 (+0000) Subject: * modules/cluster/mod_heartmonitor.c X-Git-Tag: 2.3.3~783 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=78aa2421a7500c5ef607ae525a4247ac67e6a008;p=apache * modules/cluster/mod_heartmonitor.c (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 --- diff --git a/modules/cluster/mod_heartmonitor.c b/modules/cluster/mod_heartmonitor.c index 77552587a8..bb5ab78f05 100644 --- a/modules/cluster/mod_heartmonitor.c +++ b/modules/cluster/mod_heartmonitor.c @@ -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);