aboutsummaryrefslogtreecommitdiff
path: root/plugins/popen.c
diff options
context:
space:
mode:
authorGravatar Ton Voon <tonvoon@users.sourceforge.net> 2006-02-17 09:08:08 +0000
committerGravatar Ton Voon <tonvoon@users.sourceforge.net> 2006-02-17 09:08:08 +0000
commit4a7401ea71fc7735be5fe371eb155284eb3a9583 (patch)
treed3dfad3a53c749df0841df2bca88f9bfd1f52e51 /plugins/popen.c
parent91bd5cfc686b1430fc603f1d8d18fab77514b04f (diff)
downloadmonitoring-plugins-4a7401ea71fc7735be5fe371eb155284eb3a9583.tar.gz
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
Diffstat (limited to 'plugins/popen.c')
-rw-r--r--plugins/popen.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/plugins/popen.c b/plugins/popen.c
index f6810691..5da12a02 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);
}
}