[Nagiosplug-devel] check_dns: DNS WARNING - nslookup returned error status

sean finney seanius at seanius.net
Fri Sep 2 06:03:04 CEST 2005


(sending a second copy to the list, the first got caught with too many
 cc's)

On Fri, Sep 02, 2005 at 02:23:16PM +0200, Peter Pramberger wrote:
> Please keep in mind that ECHILD is an error condition - there was no process
> found to check for. status' value is not defined after the call to waitpid, so
> the result of WIFEXITED is unpredictable.

yes, this is why simply changing to the switch statement proposed by dag
would not work.  the question is, how do we get at the status in this
case?  

this is from r'ing tfm for sigaction(2):

       POSIX.1-1990 disallowed setting the  action  for  SIGCHLD  to SIG_IGN.
       POSIX.1-2001  allows  this possibility, so that ignoring SIGCHLD can be
       used to prevent the creation of zombies (see  wait(2)).  Nevertheless,
       the historical BSD and System V behaviours for ignoring SIGCHLD differ,
       so that the only completely portable method of ensuring that terminated
       children  do not become zombies is to catch the SIGCHLD signal and per-
       form a wait(2) or similar.

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.


	sean
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://nagios-plugins.org/archive/devel/attachments/20050902/e4f026d3/attachment.sig>


More information about the Devel mailing list