Set EPOLL_CLOEXEC to prevent fd leakage for command executation

This is for the same reason #38
This commit is contained in:
Hiroki Noda 2017-12-16 10:16:43 +09:00
parent 979640b074
commit 277743914b

View file

@ -18,6 +18,9 @@ import core.sys.linux.epoll;
alias EpollEventDriver = PosixEventDriver!EpollEventLoop;
static if (!is(typeof(SOCK_CLOEXEC)))
enum SOCK_CLOEXEC = 0x80000;
final class EpollEventLoop : PosixEventLoop {
@safe: nothrow:
@ -28,7 +31,7 @@ final class EpollEventLoop : PosixEventLoop {
this()
{
m_epoll = () @trusted { return epoll_create1(0); } ();
m_epoll = () @trusted { return epoll_create1(SOCK_CLOEXEC); } ();
m_events.length = 100;
}