I *think* that in the case of Brian's question (which applies to the exec(), system() and so on family of PHP functions), we can safely loop throught the descriptors (except for those we will be using to capture or pass-thru the output) and set the close-on-exec flag prior to forking.
I don't have the time to check this out right now, maybe next week; if anyone else wants to dive in a test my theory, go ahead :) --Wez. On Fri, 30 May 2003, Zeev Suraski wrote: > At 17:44 30/05/2003, Wez Furlong wrote: > >I think I did check, but there were no useful comments. > >if close()ing them before exec'ing is a problem, can't we just set the > >close-on-exec flag on the fd's ? > > > >This will cause the descriptors to be dup'd for the fork, and the > >duplicates to be closed when the child execs; in theory, that will leave > >the parent in a fit and healthy state. > > This whole problem didn't add up to me - it didn't sound too logical to > begin with. Anyway - after some archeological searches in my mailbox from > 1998 (never erase email!) - here's the real reason. > > http://www.phpbuilder.com/mail/php3-list/199805/1391.php > > Zeev > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php