diff options
Diffstat (limited to 'plugins')
| -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; | |||
| 243 | void | 243 | void |
| 244 | popen_timeout_alarm_handler (int signo) | 244 | popen_timeout_alarm_handler (int signo) |
| 245 | { | 245 | { |
| 246 | int fh; | ||
| 246 | if (signo == SIGALRM) { | 247 | if (signo == SIGALRM) { |
| 247 | kill (childpid[fileno (child_process)], SIGKILL); | 248 | fh=fileno (child_process); |
| 249 | if(fh >= 0){ | ||
| 250 | kill (childpid[fh], SIGKILL); | ||
| 251 | } | ||
| 248 | printf (_("CRITICAL - Plugin timed out after %d seconds\n"), | 252 | printf (_("CRITICAL - Plugin timed out after %d seconds\n"), |
| 249 | timeout_interval); | 253 | timeout_interval); |
| 250 | exit (STATE_CRITICAL); | 254 | 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 *); | |||
| 9 | RETSIGTYPE popen_timeout_alarm_handler (int); | 9 | RETSIGTYPE popen_timeout_alarm_handler (int); |
| 10 | 10 | ||
| 11 | extern unsigned int timeout_interval; | 11 | extern unsigned int timeout_interval; |
| 12 | pid_t *childpid; | 12 | pid_t *childpid=NULL; |
| 13 | int *child_stderr_array; | 13 | int *child_stderr_array=NULL; |
| 14 | FILE *child_process; | 14 | FILE *child_process=NULL; |
| 15 | FILE *child_stderr; | 15 | FILE *child_stderr=NULL; |
