diff options
-rw-r--r-- | plugins/popen.c | 6 | ||||
-rw-r--r-- | plugins/popen.h | 8 |
2 files changed, 9 insertions, 5 deletions
diff --git a/plugins/popen.c b/plugins/popen.c index 04eb3881..062cf274 100644 --- a/plugins/popen.c +++ b/plugins/popen.c @@ -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); diff --git a/plugins/popen.h b/plugins/popen.h index 1f4e413a..c2a79df0 100644 --- a/plugins/popen.h +++ b/plugins/popen.h @@ -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; |