Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!dkuug!dkuugin!shj From: shj@login.dkuug.dk (Stig Jacobsen) Newsgroups: comp.unix.programmer Subject: Re: Detecting exec(2) failing after performing fork(2)? Message-ID: Date: 8 Mar 91 15:50:05 GMT References: <1991Mar1.205944.13198@crc.skl.dnd.ca> <1991Mar4.231540.17644@nat.vu.nl> <1991Mar7.222033.4711@nat.vu.nl> Sender: news@slyrf.dkuug.dk Lines: 20 maart@nat.vu.nl (Maarten Litmaath) writes: >One thing I forgot to mention: don't forget to wait() for the child, >_even_ when the spawn() has failed! Since I didn't want to wait() for anything, I just performed another fork() in the spawn() function and then let the first child exit() imediately, so that the second child would get init (process 1) as parent. This way I avoid a zombie process. Rather wastefull, yes, but I couldn't find another way to disassociate my child process from the parent. >If your UNIX variant has wait4(2), waitfor(2) or waitpid(2), It does not; its a lowly System V r3.2. -- Stig Jacobsen shj@login.dkuug.dk / sysadm