From 4a7401ea71fc7735be5fe371eb155284eb3a9583 Mon Sep 17 00:00:00 2001 From: Ton Voon Date: Fri, 17 Feb 2006 09:08:08 +0000 Subject: [PATCH] SIGALRM could be received before child_process is created (Jason Crawford) git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1317 f882894a-f735-0410-b71e-b25c423dba1c --- THANKS.in | 1 + plugins/popen.c | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/THANKS.in b/THANKS.in index 9fee025..3aff4bf 100644 --- a/THANKS.in +++ b/THANKS.in @@ -174,3 +174,4 @@ Rick Frey Serhan Kiymaz Gerhard Lausser Jon Vandegrift +Jason Crawford diff --git a/plugins/popen.c b/plugins/popen.c index f681069..5da12a0 100644 --- a/plugins/popen.c +++ b/plugins/popen.c @@ -270,12 +270,16 @@ popen_timeout_alarm_handler (int signo) { int fh; if (signo == SIGALRM) { - fh=fileno (child_process); - if(fh >= 0){ - kill (childpid[fh], SIGKILL); - } - printf (_("CRITICAL - Plugin timed out after %d seconds\n"), + if (child_process != NULL) { + fh=fileno (child_process); + if(fh >= 0){ + kill (childpid[fh], SIGKILL); + } + printf (_("CRITICAL - Plugin timed out after %d seconds\n"), timeout_interval); + } else { + printf (_("CRITICAL - popen timeout received, but no child process\n")); + } exit (STATE_CRITICAL); } } -- 2.30.2