Path: utzoo!attcan!uunet!virtech!cpcahil From: cpcahil@virtech.uucp (Conor P. Cahill) Newsgroups: comp.unix.questions Subject: Re: SYS V SIGCLD Handling Message-ID: <1989Nov20.124459.26023@virtech.uucp> Date: 20 Nov 89 12:44:59 GMT References: <957@sdrc.UUCP> Organization: Virtual Technologies Inc. Lines: 22 In article <957@sdrc.UUCP>, scjones@sdrc.UUCP (Larry Jones) writes: > #include > handler() > { signal(SIGCLD, handler); } > > main() > { signal(SIGCLD, handler); if (fork() == 0) exit(0); } > > When I run this on my Sys Vr3.0 system, it goes into recursive > death. As soon as the handler calls signal to reestablish > itself, it is immediately reinvoked. Am I doing something wrong, Yes. You need to wait for the child in the handler. If you have more than one possible child, you need to wait for however many of them there could be (usually you use alarm() to time out the wait). -- +-----------------------------------------------------------------------+ | Conor P. Cahill uunet!virtech!cpcahil 703-430-9247 ! | Virtual Technologies Inc., P. O. Box 876, Sterling, VA 22170 | +-----------------------------------------------------------------------+