From 0b6423f9c99d9edf8c96fefd0f6c453859395aa1 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 30 Sep 2013 00:03:24 +0200 Subject: Import Nagios Plugins site Import the Nagios Plugins web site, Cronjobs, infrastructure scripts, and configuration files. --- web/attachments/148122-waitpid.patch | 54 ++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 web/attachments/148122-waitpid.patch (limited to 'web/attachments/148122-waitpid.patch') diff --git a/web/attachments/148122-waitpid.patch b/web/attachments/148122-waitpid.patch new file mode 100644 index 0000000..dc6c06a --- /dev/null +++ b/web/attachments/148122-waitpid.patch @@ -0,0 +1,54 @@ +--- nagios-plugins-1.4.1/plugins/popen.c.orig 2005-09-05 14:02:00.314775817 +0200 ++++ nagios-plugins-1.4.1/plugins/popen.c 2005-09-05 14:16:21.427287267 +0200 +@@ -30,6 +30,7 @@ + + FILE *spopen (const char *); + int spclose (FILE *); ++static RETSIGTYPE popen_sigchld_handler (int); + RETSIGTYPE popen_timeout_alarm_handler (int); + + #include /* ANSI C header file */ +@@ -66,6 +67,7 @@ + /*int *childerr = NULL;*//* ptr to array allocated at run-time */ + /*extern pid_t *childpid = NULL; *//* ptr to array allocated at run-time */ + static int maxfd; /* from our open_max(), {Prog openmax} */ ++static volatile int childtermd = 0; /* set by SIGCHLD handler */ + + FILE * + spopen (const char *cmdstring) +@@ -171,6 +173,10 @@ + if (pipe (pfderr) < 0) + return (NULL); /* errno set by pipe() */ + ++ if (signal (SIGCHLD, popen_sigchld_handler) == SIG_ERR) { ++ usage4 (_("Cannot catch SIGCHLD")); ++ } ++ + if ((pid = fork ()) < 0) + return (NULL); /* errno set by fork() */ + else if (pid == 0) { /* child */ +@@ -220,6 +226,8 @@ + if (fclose (fp) == EOF) + return (1); + ++ while (!childtermd); /* wait until SIGCHLD */ ++ + while (waitpid (pid, &status, 0) < 0) + if (errno != EINTR) + return (1); /* error other than EINTR from waitpid() */ +@@ -239,8 +247,14 @@ + #define OPEN_MAX_GUESS 256 /* if OPEN_MAX is indeterminate */ + /* no guarantee this is adequate */ + ++static RETSIGTYPE ++popen_sigchld_handler (int signo) ++{ ++ if (signo == SIGCHLD) ++ childtermd = 1; ++} + +-void ++RETSIGTYPE + popen_timeout_alarm_handler (int signo) + { + int fh; -- cgit v1.2.3-74-g34f1