[Nagiosplug-checkins] nagiosplug/plugins popen.c,1.11,1.12 popen.h,1.3,1.4

M. Sean Finney seanius at users.sourceforge.net
Sun May 1 13:13:13 CEST 2005


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

Modified Files:
	popen.c popen.h 
Log Message:
better error checking in spopen signal handler (see 1107524)

Index: popen.h
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/popen.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- popen.h	25 Dec 2004 23:17:44 -0000	1.3
+++ popen.h	1 May 2005 20:12:03 -0000	1.4
@@ -9,7 +9,7 @@
 RETSIGTYPE popen_timeout_alarm_handler (int);
 
 extern unsigned int timeout_interval;
-pid_t *childpid;
-int *child_stderr_array;
-FILE *child_process;
-FILE *child_stderr;
+pid_t *childpid=NULL;
+int *child_stderr_array=NULL;
+FILE *child_process=NULL;
+FILE *child_stderr=NULL;

Index: popen.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/popen.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- popen.c	25 Dec 2004 23:17:44 -0000	1.11
+++ popen.c	1 May 2005 20:12:03 -0000	1.12
@@ -243,8 +243,12 @@
 void
 popen_timeout_alarm_handler (int signo)
 {
+	int fh;
 	if (signo == SIGALRM) {
-		kill (childpid[fileno (child_process)], SIGKILL);
+		fh=fileno (child_process);
+		if(fh >= 0){
+			kill (childpid[fh], SIGKILL);
+		}
 		printf (_("CRITICAL - Plugin timed out after %d seconds\n"),
 						timeout_interval);
 		exit (STATE_CRITICAL);





More information about the Commits mailing list