[Nagiosplug-checkins] nagiosplug/plugins popen.c,1.13,1.14

Ton Voon tonvoon at users.sourceforge.net
Fri Feb 17 01:09:07 CET 2006


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14843/plugins

Modified Files:
	popen.c 
Log Message:
SIGALRM could be received before child_process is created (Jason Crawford)


Index: popen.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/popen.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- popen.c	12 Sep 2005 10:31:28 -0000	1.13
+++ popen.c	17 Feb 2006 09:08:08 -0000	1.14
@@ -270,12 +270,16 @@
 {
 	int fh;
 	if (signo == SIGALRM) {
-		fh=fileno (child_process);
-		if(fh >= 0){
-			kill (childpid[fh], SIGKILL);
-		}
-		printf (_("CRITICAL - Plugin timed out after %d seconds\n"),
+		if (child_process != NULL) {
+			fh=fileno (child_process);
+			if(fh >= 0){
+				kill (childpid[fh], SIGKILL);
+			}
+			printf (_("CRITICAL - Plugin timed out after %d seconds\n"),
 						timeout_interval);
+		} else {
+			printf (_("CRITICAL - popen timeout received, but no child process\n"));
+		}
 		exit (STATE_CRITICAL);
 	}
 }





More information about the Commits mailing list