Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


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

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.