]> git.tokkee.org Git - nagiosplug.git/commitdiff

Code

better error checking in spopen signal handler (see 1107524)
authorM. Sean Finney <seanius@users.sourceforge.net>
Sun, 1 May 2005 20:12:03 +0000 (20:12 +0000)
committerM. Sean Finney <seanius@users.sourceforge.net>
Sun, 1 May 2005 20:12:03 +0000 (20:12 +0000)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1169 f882894a-f735-0410-b71e-b25c423dba1c

plugins/popen.c
plugins/popen.h

index 04eb3881b328fa0e0938a5b93295f661231119db..062cf274a476fe8a775c2c562c777747a046f9f3 100644 (file)
@@ -243,8 +243,12 @@ static int openmax = 0;
 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);
index 1f4e413a7e8c65c8f0da388139cef80781ae5b9d..c2a79df09c422fc188a203af8f98ca060925e626 100644 (file)
@@ -9,7 +9,7 @@ int spclose (FILE *);
 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;