summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 205dda8)
raw | patch | inline | side by side (parent: 205dda8)
author | M. Sean Finney <seanius@users.sourceforge.net> | |
Sun, 1 May 2005 20:12:03 +0000 (20:12 +0000) | ||
committer | M. 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 | patch | blob | history | |
plugins/popen.h | patch | blob | history |
diff --git a/plugins/popen.c b/plugins/popen.c
index 04eb3881b328fa0e0938a5b93295f661231119db..062cf274a476fe8a775c2c562c777747a046f9f3 100644 (file)
--- a/plugins/popen.c
+++ b/plugins/popen.c
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 1f4e413a7e8c65c8f0da388139cef80781ae5b9d..c2a79df09c422fc188a203af8f98ca060925e626 100644 (file)
--- a/plugins/popen.h
+++ b/plugins/popen.h
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;