Linus Torvalds <torva...@linux-foundation.org> writes: > On Fri, Oct 28, 2016 at 9:48 AM, Junio C Hamano <gits...@pobox.com> wrote: >> >> Setting FD_CLOEXEC with fcntl(2) may be racy, but in what way >> it is broken to open(2) with O_CLOEXEC? > > Apparently windows doesn't even support it, at least not mingw. So > you'll have to have some supprt for just explicitly closing things at > execve anyway. And if you do that for windows, then what's the point > of using O_CLOEXEC on Linux, and having two totally different paths > that will just mean maintenance headache.
Ah, that's where your reaction comes from. If I understood Dscho correctly, what he said was that I cannot set FD_CLOEXEC via fcntl() emulation they have. It wasn't an objection to O_CLOEXEC. In fact, since 05d1ed6148 ("mingw: ensure temporary file handles are not inherited by child processes", 2016-08-22), we have been relying on open(2) with O_CLOEXEC even on Windows (by emulating it with O_NOINHERIT, which Windows has) on some codepaths.