Mercurial > hg > nginx
diff src/core/ngx_cycle.c @ 449:3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sun, 03 Oct 2004 20:02:06 +0000 |
parents | 241dc8092a33 |
children | 23fb87bddda1 |
line wrap: on
line diff
--- a/src/core/ngx_cycle.c Fri Oct 01 15:53:53 2004 +0000 +++ b/src/core/ngx_cycle.c Sun Oct 03 20:02:06 2004 +0000 @@ -328,24 +328,6 @@ } } -#if !(WIN32) - - if (!failed && !ngx_test_config && cycle->log->file->fd != STDERR_FILENO) { - - ngx_log_debug3(NGX_LOG_DEBUG_CORE, log, 0, - "dup2: %0X %d \"%s\"", - cycle->log->file, - cycle->log->file->fd, cycle->log->file->name.data); - - if (dup2(cycle->log->file->fd, STDERR_FILENO) == NGX_ERROR) { - ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, - "dup2(STDERR) failed"); - failed = 1; - } - } - -#endif - if (failed) { /* rollback the new cycle configuration */ @@ -364,7 +346,9 @@ i = 0; } - if (file[i].fd == NGX_INVALID_FILE) { + if (file[i].fd == NGX_INVALID_FILE + || file[i].fd == ngx_stderr_fileno) + { continue; } @@ -400,9 +384,27 @@ /* commit the new cycle configuration */ +#if !(WIN32) + + if (!ngx_test_config && cycle->log->file->fd != STDERR_FILENO) { + + ngx_log_debug3(NGX_LOG_DEBUG_CORE, log, 0, + "dup2: %0X %d \"%s\"", + cycle->log->file, + cycle->log->file->fd, cycle->log->file->name.data); + + if (dup2(cycle->log->file->fd, STDERR_FILENO) == NGX_ERROR) { + ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, + "dup2(STDERR) failed"); + /* fatal */ + exit(1); + } + } + +#endif + pool->log = cycle->log; - for (i = 0; ngx_modules[i]; i++) { if (ngx_modules[i]->init_module) { if (ngx_modules[i]->init_module(cycle) == NGX_ERROR) { @@ -446,7 +448,7 @@ i = 0; } - if (file[i].fd == NGX_INVALID_FILE) { + if (file[i].fd == NGX_INVALID_FILE || file[i].fd == ngx_stderr_fileno) { continue; }