From 1ff3d00020572f354531227b9854d35edfbb3b4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Mon, 27 Mar 2017 16:31:00 +0200 Subject: [PATCH] Check return value of eventfd for errors. --- source/eventcore/drivers/posix/events.d | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/eventcore/drivers/posix/events.d b/source/eventcore/drivers/posix/events.d index 2c703b6..02f95c8 100644 --- a/source/eventcore/drivers/posix/events.d +++ b/source/eventcore/drivers/posix/events.d @@ -35,7 +35,9 @@ final class PosixEventDriverEvents(Loop : PosixEventLoop, Sockets : EventDriverS final override EventID create() { version (linux) { - auto id = cast(EventID)eventfd(0, EFD_NONBLOCK); + auto eid = eventfd(0, EFD_NONBLOCK); + if (eid == -1) return EventID.invalid; + auto id = cast(EventID)eid; m_loop.initFD(id); m_loop.m_fds[id].specific = EventSlot(new ConsumableQueue!EventCallback); // FIXME: avoid dynamic memory allocation m_loop.registerFD(id, EventMask.read);