On Wed, Aug 06, 2003 at 06:45:22PM -0700, Earle F. Philhower III wrote: >Howdy Christopher, Igor, and Harold... > >... >>Two small notes here: >>1) You can actually call setenv("DISPLAY", value) inside the XWin process, >>which will be inherited by XWin's children. >... >>On Wed, Aug 06, 2003 at 01:06:55PM -0400, Harold L Hunt II wrote: >>>The for loop that you have is the way I have seen it done before. >>Me too. However, if you can find an API specification for something >>which does something similar in the Single Unix Specification, I'd be >>...>> getrlimit(RLIMIT_NOFILE, &rl); >>>> for (i = STDERR_FILENO+1; i < rl.rlim_max; i++) >>>> (void) close(i); >>>>but that seems wasteful to iterate over rlim_max... >(make that rlim_cur, closing 4 billion descriptors takes too long...) > >I'm attaching another diff (against test95 plain), be sure to so a >"make Makefiles" and "make depend" before "make XWin.exe". > >It does all the prior stuff and >a) Closes all fds on the fork()'d process
It *may* be helpful to call setsid() at this point, after you've closed the file descriptors. cgf