rem: while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
add: while ((pid=waitpid(-1, &status, WNOHANG))>0 || (pid<0 && errno==EINTR)) {
context: buryChild(int foo){    pid_t pid;    int status;        /* R.I.P. */    /* SIGCHLD's are blocked while we are in this signal handler, and if 2 or     * more kids exit while we handle the exit of one child in this handler     * (ie, about at the same time), we will miss the SIGCHLD signals the     * other kids will send and will be left with zombies. Using a while loop     * tries to avoid this (or at least minimize the probability), by calling     * waitpid until there are no more exited kids that respond.     * I think there is still a small probability that a a SIGCHLD signal can     * arrive after we finished the while loop, but before we return.     * Passing SA_NODEFER to the SIGCHLD handler doesn't seem to help at all,     * though tha man page sais that using this flag should allow receival of     * other SIGCHLD signals while processing one. Why is this? -Dan     *     * There seem to be SA_NOCLDWAIT, but I'm not sure its available on all     * platforms, and its possible that even if it will prevent zombie     * generation, it may also prevent us from receiving the exit status     * of our kids (I'm not sure, because the man page doesn't state this     * clearly). -Dan     *     * Maybe the best way would be to forget about SA_NODEFER and do it the     * old way: unblock SIGCHLD immediately after we entered this handler,     * then call waitpid in a while loop to get the exit status of all kids     * that exited while SIGCHLD was blocked and we missed the signal.     * This way there is no way we can miss any kid, because the while loop     * takes care of signals that were missed before we reenabled SIGCHLD     * and after enabling the signal, we we start getting them even if we     * are in the signal handler itself. Only need to check if it doesn't     * have any problem with reentrancy, but I don't think so. -Dan     */    while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {	NotifyDeadProcess(pid, WEXITSTATUS(status));	/* 	 * Make sure that the kid will be buried even if there are	 * no events in the X event queue	 */	if (!WDelayedActionSet) {	    WDelayedActionSet = 1;	    WMAddIdleHandler(delayedAction, NULL);	}    }}