So it sounds like you're arguing that close-on-exec should be the default -- and if backwards
compatibility forbids it *actually* being default, then we should write code in such a way
that it becomes the default. I tend to agree. The original argument that I was responding
to, though, was suggesting that it didn't much matter if close-on-exec were broken, which
seems like the opposite of your point...
Posted Aug 15, 2008 17:27 UTC (Fri) by sethml (subscriber, #8471)
[Link]
How about a call similar to closefrom(), but which takes a list of fds not to close, and
closes
all fds but those in the list? This avoids the brain-dead assumptions about fd ordering which
closefrom() makes, but makes it easy to leave just a select few fds open for the child. As
the
parent comment points out, any code which relies on leaving fds other than stdout/stdin/
stderr open for the child probably knows exactly which fds the child will need.