[icinga-checkins] icinga.org: icinga-core/hbaecker/perl-tests: fixed race condition for check_daemon_running() to re-enable tests

git at icinga.org git at icinga.org
Wed Jan 20 11:27:15 CET 2010


Module: icinga-core
Branch: hbaecker/perl-tests
Commit: c001919b0b918d136d548fc71b921d86a83d5bd1
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=c001919b0b918d136d548fc71b921d86a83d5bd1

Author: Hendrik Baecker <andurin at process-zero.de>
Date:   Wed Jan 20 11:26:16 2010 +0100

fixed race condition for check_daemon_running() to re-enable tests

Also added int daemon_check to display_info_table

---

 cgi/cgiutils.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/cgi/cgiutils.c b/cgi/cgiutils.c
index 74c0ea5..16fef9a 100644
--- a/cgi/cgiutils.c
+++ b/cgi/cgiutils.c
@@ -563,11 +563,6 @@ int read_all_status_data(char *config_file,int options){
 	if(service_status_has_been_read==TRUE && (options & READ_SERVICE_STATUS))
 		options-=READ_SERVICE_STATUS;
 
-        /* return error if daemon is not running */
-        if(check_daemon_running()==ERROR) {
-                return ERROR;
-        }
-
 	/* bail out if we've already read what we need */
 	if(options<=0)
 		return OK;
@@ -583,6 +578,11 @@ int read_all_status_data(char *config_file,int options){
 	if(options & READ_SERVICE_STATUS)
 		service_status_has_been_read=TRUE;
 
+        /* return error if daemon is not running */
+        if(check_daemon_running()==ERROR) {
+                return ERROR;
+        }
+
 	return result;
         }
 
@@ -1747,7 +1747,7 @@ void determine_log_rotation_times(int archive){
  *************** COMMON HTML FUNCTIONS ********************
  **********************************************************/
 
-void display_info_table(char *title,int refresh, authdata *current_authdata){
+void display_info_table(char *title,int refresh, authdata *current_authdata, int daemon_check){
 	time_t current_time;
 	char date_time[MAX_DATETIME_LENGTH];
 	int result;
@@ -1777,7 +1777,7 @@ void display_info_table(char *title,int refresh, authdata *current_authdata){
 	if(nagios_process_state!=STATE_OK)
 		printf("<DIV CLASS='infoBoxBadProcStatus'>Warning: Monitoring process may not be running!<BR>Click <A HREF='%s?type=%d'>here</A> for more info.</DIV>",EXTINFO_CGI,DISPLAY_PROCESS_INFO);
 
-	if(result==ERROR)
+	if(result==ERROR && daemon_check == TRUE)
 		printf("<DIV CLASS='infoBoxBadProcStatus'>Warning: Could not read program status information!</DIV>");
 
 	else{





More information about the icinga-checkins mailing list