Always close epoll/kqueue file descriptor (#2723)

Resolves #2643, resolves #2721
This commit is contained in:
Johan Fleury 2019-02-24 07:38:50 -05:00 committed by Janek Bevendorff
parent 9bc20f0b42
commit e8ec45ef97

View File

@ -65,6 +65,7 @@ void NativeMessagingBase::newNativeMessage()
EV_SET(ev, fileno(stdin), EVFILT_READ, EV_ADD, 0, 0, nullptr);
if (kevent(fd, ev, 1, nullptr, 0, &ts) == -1) {
m_notifier->setEnabled(false);
::close(fd);
return;
}
@ -81,6 +82,7 @@ void NativeMessagingBase::newNativeMessage()
event.data.fd = 0;
if (epoll_ctl(fd, EPOLL_CTL_ADD, 0, &event) != 0) {
m_notifier->setEnabled(false);
::close(fd);
return;
}