Merge of r5017: fixed null dereference with resolver and poll.

Events: fixed null pointer dereference with resolver and poll.

A POLLERR signalled by poll() without POLLIN/POLLOUT, as seen on
Linux, would generate both read and write events, but there's no
write event handler for resolver events.  A fix is to only call
event handler of an active event.
This commit is contained in:
Maxim Dounin 2013-02-11 16:06:39 +00:00
parent f0ddd86389
commit aaf45df542
1 changed files with 2 additions and 2 deletions

View File

@ -371,7 +371,7 @@ ngx_poll_process_events(ngx_cycle_t *cycle, ngx_msec_t timer, ngx_uint_t flags)
found = 0;
if (revents & POLLIN) {
if ((revents & POLLIN) && c->read->active) {
found = 1;
ev = c->read;
@ -388,7 +388,7 @@ ngx_poll_process_events(ngx_cycle_t *cycle, ngx_msec_t timer, ngx_uint_t flags)
ngx_locked_post_event(ev, queue);
}
if (revents & POLLOUT) {
if ((revents & POLLOUT) && c->write->active) {
found = 1;
ev = c->write;