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

Dag Wieers dag at wieers.com
Fri Sep 2 05:04:10 CEST 2005


On Fri, 2 Sep 2005, sean finney wrote:

> now, a question about this patch...
> 
> the code in question:
> 
> ==
>     while (waitpid (pid, &status, 0) < 0)
>     {
>         if (errno == ECHILD)
>             return (0);                         /* Child has already exited */
> 
>         if (errno != EINTR)
>             return (1);                         /* error other than EINTR from waitpid() */
>     }
> 
>     if (WIFEXITED (status))
>         return (WEXITSTATUS (status));  /* return child's termination status */
> >     return (1);
> ==
> 
> does this remove the check for the child's exit status?

The patch is not mine, but I think you are correct. It probably should be 
something like:

	while (waitpid (pid, &status, 0) < 0) {

		switch(errno) {
			case ECHILD: break;		/* Child has already exited */
			case EINTR: break;		/* Interrupted function call */
			case default: return 1;
		}

	}

	if (WIFEXITED (status))
		return (WEXITSTATUS (status));  /* return child's termination status */

	return 1;

I add the author (Peter Pramberger) of this patch into the discussion as 
well.

Kind regards,
--   dag wieers,  dag at wieers.com,  http://dag.wieers.com/   --
[all I want is a warm bed and a kind word and unlimited power]




More information about the Devel mailing list