From 463b49f1bd6daaaa144609613708985dac8bc004 Mon Sep 17 00:00:00 2001 From: Sergey Lyubka <valenok@gmail.com> Date: Sat, 16 Feb 2013 12:54:02 +0000 Subject: [PATCH] Fixed poll() issue with QNX --- mongoose.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mongoose.c b/mongoose.c index 4e6cbd787..896e4325e 100644 --- a/mongoose.c +++ b/mongoose.c @@ -5014,7 +5014,11 @@ static void *master_thread(void *thread_func_param) { if (poll(pfd, ctx->num_listening_sockets, 200) > 0) { for (i = 0; i < ctx->num_listening_sockets; i++) { - if (ctx->stop_flag == 0 && pfd[i].revents == POLLIN) { + // NOTE(lsm): on QNX, poll() returns POLLRDNORM after the + // successfull poll, and POLLIN is defined as (POLLRDNORM | POLLRDBAND) + // Therefore, we're checking pfd[i].revents & POLLIN, not + // pfd[i].revents == POLLIN. + if (ctx->stop_flag == 0 && (pfd[i].revents & POLLIN)) { accept_new_connection(&ctx->listening_sockets[i], ctx); } } -- GitLab