You cannot check if a zombie process is with pure POSIX calls - unless you are a parent process and reap it with the waitlast name . Therefore, you need to find a good place to wait for the baby.
One option is to install a handler SIGCHLDand do it there waitpid(0, &status, WNOHANG). Be sure to loop until he no longer finds any processes - if two children die in a short period of time, you can get only one SIGCHLD.
- fork, fork(), ( A) fork, ( B) exec. . wait() ing A. A , B, . , , B, , , .