summaryrefslogtreecommitdiff
path: root/src/socketengines/socketengine_epoll.cpp
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2012-05-20 07:36:57 -0500
committerWilliam Pitcock <nenolod@dereferenced.org>2012-05-20 07:41:08 -0500
commit5245a9d7c49b2b397f38b915382adae3483b6e17 (patch)
treefb030e0399be14e3692cb5534a63ea199767df88 /src/socketengines/socketengine_epoll.cpp
parent2916ae7c920c069ff180f0224b2dc953bbd32501 (diff)
epoll: make sure EPOLLET flag does not get clobbered
EPOLLET is the highest bit, so storing EPOLLET in a signed value leads to undefined behaviour.
Diffstat (limited to 'src/socketengines/socketengine_epoll.cpp')
-rw-r--r--src/socketengines/socketengine_epoll.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/socketengines/socketengine_epoll.cpp b/src/socketengines/socketengine_epoll.cpp
index 567ddd69f..79d69698a 100644
--- a/src/socketengines/socketengine_epoll.cpp
+++ b/src/socketengines/socketengine_epoll.cpp
@@ -90,9 +90,9 @@ EPollEngine::~EPollEngine()
delete[] events;
}
-static int mask_to_epoll(int event_mask)
+static unsigned mask_to_epoll(int event_mask)
{
- int rv = 0;
+ unsigned rv = 0;
if (event_mask & (FD_WANT_POLL_READ | FD_WANT_POLL_WRITE | FD_WANT_SINGLE_WRITE))
{
// we need to use standard polling on this FD
@@ -149,8 +149,8 @@ bool EPollEngine::AddFd(EventHandler* eh, int event_mask)
void EPollEngine::OnSetEvent(EventHandler* eh, int old_mask, int new_mask)
{
- int old_events = mask_to_epoll(old_mask);
- int new_events = mask_to_epoll(new_mask);
+ unsigned old_events = mask_to_epoll(old_mask);
+ unsigned new_events = mask_to_epoll(new_mask);
if (old_events != new_events)
{
// ok, we actually have something to tell the kernel about