[Nagiosplug-devel] check_dns: DNS WARNING - nslookup returned error status
Ton Voon
tonvoon at mac.com
Fri Sep 2 06:53:41 CEST 2005
On 2 Sep 2005, at 13:40, sean finney wrote:
> so what, redhat is now defaulting to having that set? i think i see a
> way around this, but i'm not sure:
>
> - set a signal handler for SIGCHLD
> - when SIGCHLD is thrown, we do exactly the opposite from the
> above, and
> *not* call any wait functions.
>
> i think that should leave the child as a zombie, for our later call to
> waitpid.
Tried this patch to popen.c:
--- popen.c.original 2005-09-02 14:02:33.760495184 +0100
+++ popen.c 2005-09-02 14:30:08.322963456 +0100
@@ -67,6 +67,8 @@
/*extern pid_t *childpid = NULL; *//* ptr to array allocated at run-
time */
static int
maxfd; /
* from our open_max(), {Prog openmax} */
+void sigchld_handler(int signo) { printf( "Caught sigchld\n");
return; } /* Do nothing */
+
FILE *
spopen (const char *cmdstring)
{
@@ -171,6 +173,7 @@
if (pipe (pfderr) < 0)
return
(NULL); /* errno set
by pipe() */
+ signal(SIGCHLD, &sigchld_handler);
if ((pid = fork ()) < 0)
return
(NULL); /* errno set
by fork() */
else if (pid == 0) { /*
child */
While this works consistently on debian and MacOSX (with output of:
Caught sigchld
DNS OK: 0.099 seconds response time altinity.com returns
216.68.81.208|time=0.098571s;;;0.000000
wrapped in a 'while true; do ./check_dns -H altinity.com || break ;
done' loop), I still get the occasional error on Red Hat. Amazingly,
there is no Caught sigchld for the failing scenario, which I find
hard to understand. Any other suggestions from anyone?
Ton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20050902/97ebdbd1/attachment.html>
More information about the Devel
mailing list