Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Elegant

Name: Anonymous 2008-05-19 11:22

An elegant solution for this:

    /*
    note: the double-fork construct avoids zombie processes
    and keeps the code clean from stupid signal handlers.
    */

    ...
    if(fork() == 0) {
        if(fork() == 0) {
            ..
            execl(pp, pp, (char*) NULL);
            _exit(0);
        }
        _exit(0);
    }
    wait(NULL);
    ..

Thanks

Name: Anonymous 2008-05-20 10:36

>>15
if you ignore SIGCHLD you won't get zombie processes.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List