Hi,
Accordingly to manpages, waitpid is expected to return -1 on error. As run_async_host_check_3x() and run_async_service_check() already return an ERROR when a problem during fork occurs, i believe it's appropriate to return an ERROR when we are unable to wait for child pid as well.
This patch address some "set but not used [-Wunused-but-set-variable]" warning during nagios compilation.
OK? Comments?
--- base/checks.c (revision 1973)
+++ base/checks.c (working copy)
@@ -878,6 +878,9 @@
/* don't do this if large install tweaks are enabled - we'll clean up children in event loop */
if(child_processes_fork_twice == TRUE)
wait_result = waitpid(pid, NULL, 0);
+ if(wait_result == -1) {
+ return ERROR;
+ }
}
/* see if we were able to run the check... */
@@ -3264,6 +3267,9 @@
/* if large install tweaks are enabled, we'll clean up the zombie process later */
if(child_processes_fork_twice == TRUE)
wait_result = waitpid(pid, NULL, 0);
+ if(wait_result == -1) {
+ return ERROR;
+ }
}
/* see if we were able to run the check... */
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: ricardo.maraschini@opservices.com.br