Pierre A. Humblet
Thu Jan 14 13:40:00 GMT 2010
At 08:17 AM 1/14/2010, Corinna Vinschen wrote:
>On Jan 14 06:02, Eric Blake wrote:
> > In a multi-threaded app, any fd that is opened only temporarily, such as
> > the one in mq_open, should be opened with O_CLOEXEC, so that no other
> > thread can win a race and do a fork/exec inside the window when the
> > temporary fd was open. So even though mq_open does not leak an fd to the
> > current process, it should pass O_CLOEXEC as part of its internal open()
> > call in order to avoid leaking the fd to unrelated child processes.
>Uh, ok, that makes sense.
>I'll send a revised patch later today. It will also include the pipe2
For the same reason we should also have SOCK_CLOEXEC, and
SOCK_NONBLOCK while we are at it. I would use them in minires.
More information about the Cygwin-patches