Comment 21 for bug 102408

Revision history for this message
In , Wan-Teh Chang (wtc-google) wrote :

One solution is to execute the following for loop in
the child process before it calls exec:

    int fd;

    for (fd = 3; fd <= MaxFdOfTheProcess; fd++) {
        (void) close(fd);
    }

You can use PR_GetSysfdTableMax as an example of getting
the value of 'MaxFdOfTheProcess'. (PR_GetSysfdTableMax
is an unsupported function, so its code may be incorrect.)