* If we ARE debugging, don't trap them, so we can
* dump core.
*/
- if (debug_flag == 0) {
+ if ((allow_core_dumps == FALSE) && (debug_flag == 0)) {
#ifdef SIGTRAP
signal(SIGTRAP, sig_fatal);
#endif
#endif
status = select(32, &readfds, NULL, NULL, tv);
+
+ /*
+ * Reap any children
+ */
+ while (waitpid(-1, &i, WNOHANG) > 0)
+ /* do nothing */;
+
if (status == -1) {
/*
* On interrupts, we clean up the
/*ARGSUSED*/
void sig_cleanup(int sig)
{
-#ifndef HAVE_PTHREAD_H
int status;
child_pid_t pid;
+#ifndef HAVE_PTHREAD_H
REQUEST *curreq;
#endif
reset_signal(SIGCHLD, sig_cleanup);
/*
- * If we're using pthreads, then there are NO child processes,
- * so the waitpid() call, and the following code, is useless.
+ * Wait for the child, without hanging.
*/
-#ifndef HAVE_PTHREAD_H
for (;;) {
pid = waitpid((pid_t)-1, &status, WNOHANG);
if (pid <= 0)
}
/*
+ * If we have pthreads, then the only children
+ * are from Exec-Program. We don't care about them,
+ * so once we've grabbed their PID's, we're done.
+ */
+#ifndef HAVE_PTHREAD_H
+ /*
* Loop over ALL of the active requests, looking
* for the one which caused the signal.
*/
if (rl_walk(sig_cleanup_walker, (void*)pid) != 0) {
radlog(L_ERR, "Failed to cleanup child %d", pid);
}
-
- }
#endif /* !defined HAVE_PTHREAD_H */
+ }
}
/*
sigaddset(&set, SIGHUP);
sigaddset(&set, SIGINT);
sigaddset(&set, SIGQUIT);
- sigaddset(&set, SIGCHLD);
pthread_sigmask(SIG_BLOCK, &set, NULL);
#endif
*/
}
- thread_exit:
/*
* This thread is exiting. Delete any additional resources
* associated with it (semaphore, etc), and free the thread