possible sigchld bug

Mikulas Patocka mikulas at artax.karlin.mff.cuni.cz
Tue Dec 23 06:26:28 EST 2003


Hi

What if you have sysv signals (i.e. signal is restored when handler is
called) and child process exits here? Zombie will be left, because SIGCHLD
is ignored at that point. Shouldn't signal be before waitpid?

Mikulas

static void
main_sigchld_handler(int sig)
{
        int save_errno = errno;
        pid_t pid;
        int status;

        while ((pid = waitpid(-1, &status, WNOHANG)) > 0 ||
            (pid < 0 && errno == EINTR))
                ;

		<----- HERE

        signal(SIGCHLD, main_sigchld_handler);
        errno = save_errno;
}




More information about the openssh-unix-dev mailing list