On 01/02/2013 02:23, Martin Buchholz wrote:
You could operate in paranoid mode and do *both* : use O_CLOEXEC and use
fcntl to set the bit after creating it, perhaps after verifying via fcntl
whether the bit was successfully set by open.
Martin
Alternatively, just leave this code out. We open sockets and files in
many other places in the libraries and don't explicitly enable the
close-on-exec flag (we do set the inheritance flag on Windows so I guess
we do have an inconsistency). Anyway, my point is that the Process code
already handles this and closes the file descriptors in the child so I
assume it doesn't matter if we have enabled the close-on-exec flag or
not. There might of course be applications or other libraries that use
fork+exec or variants directly, in which case there will be an issue if
they expect all file descriptors to have the close-on-exec flag set.
However, I assume we have this issue already as we just enable it
consistently.
-Alan.