Detecting exec(2) failing after performing fork(2)?
Stig Jacobsen
shj at login.dkuug.dk
Sat Mar 9 01:50:05 AEST 1991
maart at 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 at login.dkuug.dk / sysadm
More information about the Comp.unix.programmer
mailing list