On Mon, Sep 19, 2011 at 4:22 PM, Joerg Sonnenberger <jo...@britannica.bec.de> wrote: > No, the idea is to make it possible to set O_CLOEXEC atomically. Of > course, the pipe2 system call as implemented in Linux is kind of messed > up, since the flag attribute applies to both sides of the pipe.
If you need O_CLOEXEC, you want it to apply to both fds anyway, even if you plan on passing one fd to a child process. You just turn the appropriate cloexec flag back off after calling fork(2).