[PATCH-3-5][PATCH-3-5-5] fdo#50603: Close fds across a restart of soffice on Mac OS X

Stephan Bergmann sbergman at redhat.com
Thu Jun 21 00:18:31 PDT 2012


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


More information about the LibreOffice mailing list