Re: sigaction and waitpid causes "interrupted system call" when calling fgets()



popcornnnn@xxxxxxxxx wrote in
news:dcadb95c-8f6a-4dbe-ac2d-3cca375964b6@xxxxxxxxxxxxxxxxxxxxxx
s.com:

void install_sigaction_handler()
{
struct sigaction sa;

sa.sa_sigaction = signal_handler;
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_SIGINFO;
sigaction(SIGCHLD, &sa, NULL);
}

Look up the SA_RESTART flag in the sigaction man page. That might
help.

Also, it seems to me that you need to reap your forked children
at some point, presumably in the SIGCHLD handler.

MV
.