Title: [opsview-base] [162] Fix segfault with dependency failures
Revision
162
Author
tvoon
Date
2012-12-19 17:16:02 +0000 (Wed, 19 Dec 2012)

Log Message

Fix segfault with dependency failures

Modified Paths


Modified: trunk/Makefile
===================================================================
--- trunk/Makefile	2012-12-19 16:45:01 UTC (rev 161)
+++ trunk/Makefile	2012-12-19 17:16:02 UTC (rev 162)
@@ -492,8 +492,7 @@
 	# #cd ${NAGIOS} && cp ../patches/unlit-bulb.gif ./html/images/action.gif
 	# #cd ${NAGIOS} && cp ../patches/comment.gif ./html/images/comment.gif
 	cd ${NAGIOS} && patch -p1 < ../patches/nagios_sync_retention_file.patch
-	# TODO: We disable below as this currently causes a SEGV when reached
-	#cd ${NAGIOS} && patch -p1 < ../patches/nagios_set_dependency_failure.patch
+	cd ${NAGIOS} && patch -p1 < ../patches/nagios_set_dependency_failure.patch
 	cd ${NAGIOS} && patch -p1 < ../patches/nagios_is_active_with_renotification_interval.patch
 	# cd ${NAGIOS} && patch -p1 < ../patches/nagios_notificationmethods_nebcancel.patch
 	# # Disabling patch below. This seems to affect multiple callbacks

Modified: trunk/patches/nagios_set_dependency_failure.patch
===================================================================
--- trunk/patches/nagios_set_dependency_failure.patch	2012-12-19 16:45:01 UTC (rev 161)
+++ trunk/patches/nagios_set_dependency_failure.patch	2012-12-19 17:16:02 UTC (rev 162)
@@ -1,7 +1,15 @@
-diff -Bbur nagios-4.0.20121116.orig/base/checks.c nagios-4.0.20121116/base/checks.c
---- nagios-4.0.20121116.orig/base/checks.c	2012-11-26 16:42:30.000000000 +0000
-+++ nagios-4.0.20121116/base/checks.c	2012-11-26 17:00:00.000000000 +0000
-@@ -1263,6 +1263,22 @@
+diff -ur nagios-4.0.20121205.original//base/checks.c nagios-4.0.20121205/base/checks.c
+--- nagios-4.0.20121205.original//base/checks.c	2012-12-19 17:02:11.000000000 +0000
++++ nagios-4.0.20121205/base/checks.c	2012-12-19 17:06:53.000000000 +0000
+@@ -1213,6 +1213,7 @@
+ 	time_t current_time = 0L;
+ 	time_t preferred_time = 0L;
+ 	int check_interval = 0;
++	char *dependency_output = NULL;
+ 
+ 	log_debug_info(DEBUGL_FUNCTIONS, 0, "check_service_check_viability()\n");
+ 
+@@ -1264,6 +1265,26 @@
  			preferred_time = current_time + check_interval;
  			perform_check = FALSE;
  
@@ -19,7 +27,11 @@
 +			 * better way of setting the result, but we just use
 +			 * passive results for now
 +			 */
-+			process_passive_service_check(current_time, svc->host_name, svc->description, STATE_UNKNOWN, "Dependency failure");
++			// We have to take a copy of the dependency output message, because there is a routine to escape newlines
++			// which means the location must be writeable. Otherwise a SEGFAULT occurs
++			dependency_output = strdup("Dependency failure");
++			process_passive_service_check(current_time, svc->host_name, svc->description, STATE_UNKNOWN, dependency_output);
++			free(dependency_output);
 +
  			log_debug_info(DEBUGL_CHECKS, 2, "Execution dependencies for this service failed, so it will not be actively checked.\n");
  			}

_______________________________________________
Opsview-checkins mailing list
[email protected]
http://lists.opsview.org/lists/listinfo/opsview-checkins

Reply via email to