On 06/21/2012 08:01 AM, Lionel Elie Mamane wrote:
For my education: why can't we set the O_CLOEXEC/FD_CLOEXEC flag on
these file descriptors? This would - presumably - automatically close
the fds *after* any thread from the "old process" code could possibly
use them, but *before* any code of the new process (after exec())
executes?

There are two reasons:

1 Availability: While CLOEXEC is part of at least SUSv4, I'm not sure it is indeed available on all relevant platforms.

2 Composability: To be effective (beyond the concrete bug scenario, where it happened to be a file opened by "our own code" that caused the problem), every open(2) call would need to use O_CLOEXEC, even in library code we cannot control.

Stephan
_______________________________________________
LibreOffice mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to