[comp.unix.wizards] defunct processes

WPR0986%TNTECH.BITNET@cunyvm.cuny.edu (02/24/89)

In a previous article, logan@vsedev.vse.com (Jim Logan) write:
> I had to fork, call system() in the child, and then ignore SIGCLD
> in the parent to solve the problem (if I remember correctly).  I
> believe the problem is in the SCO Bourne shell since this
> does not occur on any other System V machine I've used.

The system() call waits until the process finishes before
it returns.  The proper way to do this would be to:

    signal (SIGCLD, SIGIGN);
    if (fork() == 0) {
        status = execvp (*argv, argv);
        printf ("execvp() failed: status --> %d\n", status);
    }

The parent process will never see the child process die, and
the parent process will not wait for the child process to
complete (unless you call wait() after the fork()).

I wouldn't think that the problem you had lies in the shell.

-Walter Rowe    (wpr0986@tntech.bitnet)