From 1cd64d081d1745436dd7c41826dfb05672dd26aa Mon Sep 17 00:00:00 2001 From: "M. Sean Finney" Date: Sun, 1 May 2005 20:12:03 +0000 Subject: better error checking in spopen signal handler (see 1107524) git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1169 f882894a-f735-0410-b71e-b25c423dba1c --- plugins/popen.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'plugins/popen.c') 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); -- cgit v1.2.3-74-g34f1