Merge pull request #141 from kubo39/patch-pipe-cloexec
Set close-on-exec flag for PipeFD
This commit is contained in:
commit
6372b4aabf
|
@ -28,7 +28,8 @@ final class PosixEventDriverPipes(Loop : PosixEventLoop) : EventDriverPipes {
|
|||
if (m_loop.m_fds[fd].common.refCount) // FD already in use?
|
||||
return PipeFD.invalid;
|
||||
|
||||
() @trusted { fcntl(system_fd, F_SETFL, fcntl(system_fd, F_GETFL) | O_NONBLOCK); } ();
|
||||
// Suprisingly cannot use O_CLOEXEC here, so use FD_CLOEXEC instead.
|
||||
() @trusted { fcntl(system_fd, F_SETFL, fcntl(system_fd, F_GETFL) | O_NONBLOCK | FD_CLOEXEC); } ();
|
||||
|
||||
m_loop.initFD(fd, FDFlags.none, PipeSlot.init);
|
||||
m_loop.registerFD(fd, EventMask.read|EventMask.write|EventMask.status);
|
||||
|
|
Loading…
Reference in a new issue