Re: fork problems (zombie children)

James R. Leu (jleu@coredcs.com)
Sun, 19 May 1996 19:44:16 -0500 (CDT)


>
> What am I doing wrong? The following program:
>
> #include <signal.h>
> #include <sys/wait.h>
> main(){
> for(;;) {
> if( !fork() ) {
> exit(0); /* child, exit immediately */
> }
> sleep(1);
> }
> }
>

What you need here is to tell the parent to ignore all signals dealing
with the death of a child process ( not the _best_ thing to do, but works
well )

Do this by doing a:

signal(SIGCHLD,SIG_IGN);

Hope this helps.

PS A good book that explains this plus MUCH more, is
UNIX Network Programing
by W. Richard Stevens
ISBN 0-13-949876-1
Cost: US $59.95

-- 
James R. Leu
Network Administrator
CORE Digital Communication Services
jleu@coredcs.com