Nagios segfault on startup when embedded perl is enabled on 7.1-stable/i386

Michael L. Squires mikes at
Mon Apr 27 15:03:30 UTC 2009

The attached file is a hack of the unofficial natios 3.0.6 patch for 
nagios-devel (nagios 3.1.0).  The patch allows nagios to start up with the 
embedded perl option in use.

The perl version installed on this system (7.2-PRERELEASE; Supermicro 
P6DCE+ with two 2Ghz Xeon processors) is perl 5.10.

My understanding is that only some instances of nagios run into problems 
with embedded perl; if you have that problem with nagios-devel then the 
attched patch file may allow you to continue.

Thanks for all the help; I'd be happy to be of assistance if any testing 
is needed.  I'm new to nagios, but have some familiarity with FreeBSD and 
the ports system.

Mike Squires
UN*X at home
Since 1986
-------------- next part --------------
--- base/utils.c.orig	2009-04-25 19:40:10.000000000 -0400
+++ base/utils.c	2009-04-25 19:40:10.000000000 -0400
@@ -3660,7 +3660,7 @@
 /* initializes embedded perl interpreter */
 int init_embedded_perl(char **env){
-	char *embedding[]={ "", "" };
+	void **embedding;
 	int exitstatus=0;
 	char *temp_buffer=NULL;
 	int argc=2;
@@ -3675,8 +3675,11 @@
-		embedding[1]=p1_file;
+		embedding = (void **)malloc(2*sizeof(char *));
+		if(embedding==NULL)
+			return ERROR;
+		*embedding=strdup("");
+		*(embedding+1)=strdup(p1_file);

More information about the freebsd-ports mailing list