Mercurial > hg > nginx
comparison src/core/ngx_cycle.c @ 2743:d8316f307b6a
issue start up errors and warning on both stderr and error_log
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 23 Apr 2009 11:13:12 +0000 |
parents | ae81441e23f4 |
children | 77264e0157ad |
comparison
equal
deleted
inserted
replaced
2742:e138f820b5dc | 2743:d8316f307b6a |
---|---|
268 ngx_destroy_cycle_pools(&conf); | 268 ngx_destroy_cycle_pools(&conf); |
269 return NULL; | 269 return NULL; |
270 } | 270 } |
271 | 271 |
272 if (ngx_test_config) { | 272 if (ngx_test_config) { |
273 ngx_log_stderr("the configuration file %s syntax is ok", | 273 ngx_log_stderr(0, "the configuration file %s syntax is ok", |
274 cycle->conf_file.data); | 274 cycle->conf_file.data); |
275 } | 275 } |
276 | 276 |
277 | 277 |
278 for (i = 0; ngx_modules[i]; i++) { | 278 for (i = 0; ngx_modules[i]; i++) { |
580 } | 580 } |
581 | 581 |
582 | 582 |
583 /* commit the new cycle configuration */ | 583 /* commit the new cycle configuration */ |
584 | 584 |
585 #if !(NGX_WIN32) | 585 if (!ngx_use_stderr && cycle->log->file->fd != ngx_stderr) { |
586 | 586 |
587 if (!ngx_test_config && cycle->log->file->fd != STDERR_FILENO) { | 587 if (ngx_set_stderr(cycle->log->file->fd) == NGX_FILE_ERROR) { |
588 | 588 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, |
589 ngx_log_debug3(NGX_LOG_DEBUG_CORE, log, 0, | 589 ngx_set_stderr_n " failed"); |
590 "dup2: %p %d \"%s\"", | 590 } |
591 cycle->log->file, | 591 } |
592 cycle->log->file->fd, cycle->log->file->name.data); | |
593 | |
594 if (dup2(cycle->log->file->fd, STDERR_FILENO) == -1) { | |
595 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, | |
596 "dup2(STDERR) failed"); | |
597 /* fatal */ | |
598 exit(1); | |
599 } | |
600 } | |
601 | |
602 #endif | |
603 | 592 |
604 pool->log = cycle->log; | 593 pool->log = cycle->log; |
605 | 594 |
606 for (i = 0; ngx_modules[i]; i++) { | 595 for (i = 0; ngx_modules[i]; i++) { |
607 if (ngx_modules[i]->init_module) { | 596 if (ngx_modules[i]->init_module) { |
695 part = part->next; | 684 part = part->next; |
696 file = part->elts; | 685 file = part->elts; |
697 i = 0; | 686 i = 0; |
698 } | 687 } |
699 | 688 |
700 if (file[i].fd == NGX_INVALID_FILE || file[i].fd == ngx_stderr_fileno) { | 689 if (file[i].fd == NGX_INVALID_FILE || file[i].fd == ngx_stderr) { |
701 continue; | 690 continue; |
702 } | 691 } |
703 | 692 |
704 if (ngx_close_file(file[i].fd) == NGX_FILE_ERROR) { | 693 if (ngx_close_file(file[i].fd) == NGX_FILE_ERROR) { |
705 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, | 694 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, |
795 part = part->next; | 784 part = part->next; |
796 file = part->elts; | 785 file = part->elts; |
797 i = 0; | 786 i = 0; |
798 } | 787 } |
799 | 788 |
800 if (file[i].fd == NGX_INVALID_FILE || file[i].fd == ngx_stderr_fileno) { | 789 if (file[i].fd == NGX_INVALID_FILE || file[i].fd == ngx_stderr) { |
801 continue; | 790 continue; |
802 } | 791 } |
803 | 792 |
804 if (ngx_close_file(file[i].fd) == NGX_FILE_ERROR) { | 793 if (ngx_close_file(file[i].fd) == NGX_FILE_ERROR) { |
805 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, | 794 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, |