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

Peter Pramberger peter at pramberger.at
Fri Sep 2 06:05:23 CEST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dag Wieers schrieb:
> 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;

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.


Regards,
Peter

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFDGEQ0cKsx5K5ighwRAhGLAJ95mMl3d4nZbsbGsxbK5XYx1IDokACeKR+Y
PX0uxOcqU6E029dwtfg1RWw=
=C1aM
-----END PGP SIGNATURE-----




More information about the Devel mailing list