From 57ca2c80133712f9ba0e0718ece7664552cfc5fe Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Wed, 6 May 2009 08:53:13 +0000 Subject: [PATCH] test event type to prevent errors --- src/event/modules/ngx_select_module.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/event/modules/ngx_select_module.c b/src/event/modules/ngx_select_module.c index 9be2c6ff3..661e7c639 100644 --- a/src/event/modules/ngx_select_module.c +++ b/src/event/modules/ngx_select_module.c @@ -147,6 +147,16 @@ ngx_select_add_event(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags) return NGX_OK; } + if ((event == NGX_READ_EVENT && ev->write) + || (event == NGX_WRITE_EVENT && !ev->write)) + { + ngx_log_error(NGX_LOG_ALERT, ev->log, 0, + "invalid select %s event fd:%d ev:%i", + ev->write ? "write" : "read", c->fd, event); + return NGX_ERROR; + } + + #if (NGX_WIN32) if ((event == NGX_READ_EVENT) && (max_read >= FD_SETSIZE)