comparison src/os/unix/ngx_process_cycle.c @ 4:4b2dafa26fe2 NGINX_0_1_2

nginx 0.1.2 *) Feature: the --user=USER, --group=GROUP, and --with-ld-opt=OPTIONS options in configure. *) Feature: the server_name directive supports *.domain.tld. *) Bugfix: the portability improvements. *) Bugfix: if configuration file was set in command line, the reconfiguration was impossible; bug appeared in 0.1.1. *) Bugfix: proxy module may get caught in an endless loop when sendfile is not used. *) Bugfix: with sendfile the response was not recoded according to the charset module directives; bug appeared in 0.1.1. *) Bugfix: very seldom bug in the kqueue processing. *) Bugfix: the gzip module compressed the proxied responses that was already compressed.
author Igor Sysoev <http://sysoev.ru>
date Thu, 21 Oct 2004 00:00:00 +0400
parents cc9f381affaa
children 46833bd150cb
comparison
equal deleted inserted replaced
3:8beaf7b3241f 4:4b2dafa26fe2
173 continue; 173 continue;
174 } 174 }
175 175
176 if (ngx_timer) { 176 if (ngx_timer) {
177 ngx_timer = 0; 177 ngx_timer = 0;
178 ngx_start_worker_processes(cycle, ccf->worker_processes, 178
179 NGX_PROCESS_JUST_RESPAWN); 179 if (!ngx_noaccepting) {
180 live = 1; 180 ngx_start_worker_processes(cycle, ccf->worker_processes,
181 ngx_signal_worker_processes(cycle, 181 NGX_PROCESS_JUST_RESPAWN);
182 live = 1;
183 ngx_signal_worker_processes(cycle,
182 ngx_signal_value(NGX_SHUTDOWN_SIGNAL)); 184 ngx_signal_value(NGX_SHUTDOWN_SIGNAL));
185 }
183 } 186 }
184 187
185 if (ngx_reconfigure) { 188 if (ngx_reconfigure) {
186 ngx_reconfigure = 0; 189 ngx_reconfigure = 0;
187 190
576 579
577 ngx_process = NGX_PROCESS_WORKER; 580 ngx_process = NGX_PROCESS_WORKER;
578 581
579 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); 582 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
580 583
581 if (ccf->group != (gid_t) NGX_CONF_UNSET) { 584 if (geteuid() == 0) {
582 if (setgid(ccf->group) == -1) { 585 if (setgid(ccf->group) == -1) {
583 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, 586 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
584 "setgid(%d) failed", ccf->group); 587 "setgid(%d) failed", ccf->group);
585 /* fatal */ 588 /* fatal */
586 exit(2); 589 exit(2);
587 } 590 }
588 } 591
589
590 if (ccf->user != (uid_t) NGX_CONF_UNSET) {
591 if (setuid(ccf->user) == -1) { 592 if (setuid(ccf->user) == -1) {
592 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, 593 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
593 "setuid(%d) failed", ccf->user); 594 "setuid(%d) failed", ccf->user);
594 /* fatal */ 595 /* fatal */
595 exit(2); 596 exit(2);
596 } 597 }
597 } 598 }
598 599
599 #if (HAVE_PR_SET_DUMPABLE) 600 #if (NGX_HAVE_PR_SET_DUMPABLE)
600 601
601 /* allow coredump after setuid() in Linux 2.4.x */ 602 /* allow coredump after setuid() in Linux 2.4.x */
602 603
603 if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) == -1) { 604 if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) == -1) {
604 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, 605 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,