comparison src/os/unix/ngx_process_cycle.c @ 4691:626157fe6f17

Fixed segfault with poll and resolver used. Poll event method needs ngx_cycle->files to work, and use of ngx_exit_cycle without files set caused null pointer dereference in resolver's cleanup on udp socket close.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 18 Jun 2012 14:10:50 +0000
parents f31162fefe01
children cb2304585a8b
comparison
equal deleted inserted replaced
4690:d91f3c78603e 4691:626157fe6f17
709 709
710 ngx_exit_log = *ngx_cycle->log; 710 ngx_exit_log = *ngx_cycle->log;
711 ngx_exit_log.file = &ngx_exit_log_file; 711 ngx_exit_log.file = &ngx_exit_log_file;
712 712
713 ngx_exit_cycle.log = &ngx_exit_log; 713 ngx_exit_cycle.log = &ngx_exit_log;
714 ngx_exit_cycle.files = ngx_cycle->files;
715 ngx_exit_cycle.files_n = ngx_cycle->files_n;
714 ngx_cycle = &ngx_exit_cycle; 716 ngx_cycle = &ngx_exit_cycle;
715 717
716 ngx_destroy_pool(cycle->pool); 718 ngx_destroy_pool(cycle->pool);
717 719
718 exit(0); 720 exit(0);
1052 1054
1053 ngx_exit_log = *ngx_cycle->log; 1055 ngx_exit_log = *ngx_cycle->log;
1054 ngx_exit_log.file = &ngx_exit_log_file; 1056 ngx_exit_log.file = &ngx_exit_log_file;
1055 1057
1056 ngx_exit_cycle.log = &ngx_exit_log; 1058 ngx_exit_cycle.log = &ngx_exit_log;
1059 ngx_exit_cycle.files = ngx_cycle->files;
1060 ngx_exit_cycle.files_n = ngx_cycle->files_n;
1057 ngx_cycle = &ngx_exit_cycle; 1061 ngx_cycle = &ngx_exit_cycle;
1058 1062
1059 ngx_destroy_pool(cycle->pool); 1063 ngx_destroy_pool(cycle->pool);
1060 1064
1061 ngx_log_error(NGX_LOG_NOTICE, ngx_cycle->log, 0, "exit"); 1065 ngx_log_error(NGX_LOG_NOTICE, ngx_cycle->log, 0, "exit");