[Nagios-devel] [PATCH] fix uninitialized array usage in

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] [PATCH] fix uninitialized array usage in

Post by Guest »


https://bugzilla.novell.com/show_bug.cgi?id=212892

sehandlers.c(561): warning #592: variable "end_time" is used before its value

---
base/sehandlers.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)

Index: nagios-2.5/base/sehandlers.c
===================================================================
--- nagios-2.5.orig/base/sehandlers.c
+++ nagios-2.5/base/sehandlers.c
@@ -251,7 +251,9 @@ int run_global_service_event_handler(ser
double exectime=0.0;
int result=0;
struct timeval start_time;
+#ifdef USE_EVENT_BROKER
struct timeval end_time;
+#endif
int macro_options=STRIP_ILLEGAL_MACRO_CHARS|ESCAPE_MACRO_CHARS;

#ifdef DEBUG0
@@ -307,10 +309,10 @@ int run_global_service_event_handler(ser
write_to_logs_and_console(temp_buffer,NSLOG_EVENT_HANDLER | NSLOG_RUNTIME_WARNING,TRUE);
}

+#ifdef USE_EVENT_BROKER
/* get end time */
gettimeofday(&end_time,NULL);

-#ifdef USE_EVENT_BROKER
/* send event data to broker */
broker_event_handler(NEBTYPE_EVENTHANDLER_END,NEBFLAG_NONE,NEBATTR_NONE,GLOBAL_SERVICE_EVENTHANDLER,(void *)svc,svc->current_state,svc->state_type,start_time,end_time,exectime,event_handler_timeout,early_timeout,result,global_service_event_handler,processed_command_line,command_output,NULL);
#endif
@@ -334,7 +336,9 @@ int run_service_event_handler(service *s
double exectime=0.0;
int result=0;
struct timeval start_time;
+#ifdef USE_EVENT_BROKER
struct timeval end_time;
+#endif
int macro_options=STRIP_ILLEGAL_MACRO_CHARS|ESCAPE_MACRO_CHARS;

#ifdef DEBUG0
@@ -386,10 +390,10 @@ int run_service_event_handler(service *s
write_to_logs_and_console(temp_buffer,NSLOG_EVENT_HANDLER | NSLOG_RUNTIME_WARNING,TRUE);
}

+#ifdef USE_EVENT_BROKER
/* get end time */
gettimeofday(&end_time,NULL);

-#ifdef USE_EVENT_BROKER
/* send event data to broker */
broker_event_handler(NEBTYPE_EVENTHANDLER_END,NEBFLAG_NONE,NEBATTR_NONE,SERVICE_EVENTHANDLER,(void *)svc,svc->current_state,svc->state_type,start_time,end_time,exectime,event_handler_timeout,early_timeout,result,svc->event_handler,processed_command_line,command_output,NULL);
#endif
@@ -460,7 +464,9 @@ int run_global_host_event_handler(host *
double exectime=0.0;
int result=0;
struct timeval start_time;
+#ifdef USE_EVENT_BROKER
struct timeval end_time;
+#endif
int macro_options=STRIP_ILLEGAL_MACRO_CHARS|ESCAPE_MACRO_CHARS;

#ifdef DEBUG0
@@ -516,10 +522,10 @@ int run_global_host_event_handler(host *
write_to_logs_and_console(temp_buffer,NSLOG_EVENT_HANDLER | NSLOG_RUNTIME_WARNING,TRUE);
}

+#ifdef USE_EVENT_BROKER
/* get end time */
gettimeofday(&end_time,NULL);

-#ifdef USE_EVENT_BROKER
/* send event data to broker */
broker_event_handler(NEBTYPE_EVENTHANDLER_END,NEBFLAG_NONE,NEBATTR_NONE,GLOBAL_HOST_EVENTHANDLER,(void *)hst,hst->current_state,hst->state_type,start_time,end_time,exectime,event_handler_timeout,early_timeout,result,global_host_event_handler,processed_command_line,command_output,NULL);
#endif
@@ -542,7 +548,9 @@ int run_host_event_handler(host *hst){
double exectime=0.0;
int result=0;
struct timeval start_time;
+#ifdef USE_EVENT_BROKER
struct timeval end_time;
+#endif
int macro_options=STRIP_ILLEGAL_MACRO_CHARS|ESCAPE_MACRO_CHARS;

#ifdef DEBUG0
@@ -558,6 +566,8 @@ int run_host_event_handler(host *hst){

#ifdef USE_EVENT_BROKER
/* send event data to broker */
+ end_time.tv_sec=0L;
+ end_time.tv_usec=0L;
broker_event_handler(NEBTYPE_EVENTHANDLER_START,NEBFLAG_NONE,NEBATTR_NONE,HOST_EVENTHANDLER,(void *)hst,hst->current_state,hst->state_type,start_time,end_time,exectime,event_handler_timeout,early_timeout,result,hst->event_handler,NULL,NULL,NULL);
#endif

@@ -592,10 +602,10 @@ int run_host_event_handler(host *hst){
write_to_logs_and_console(temp_buffer,NSLOG_EVENT_HANDLER | NSLOG_RUNTIME_WARNING,TRUE);
}

+#ifdef USE_EVENT_BROKER
/* get end time */
gettimeofday(&end_time,NULL);

-#ifdef USE_EVENT_BROKER
/* send event data to broker */
broker_event_handler(NEBTYPE_EVENTHANDLER_END,NEBFLAG_NONE,NEBATTR_NONE,HOST_EVENTHANDLER,(void *)hst,hst->current_state,hst->state_type,start_time,end_time,exectime,event_handler_timeout,early_timeout,result,hst->

...[email truncated]...


This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked