aboutsummaryrefslogtreecommitdiff
path: root/src/core/ngx_cycle.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2004-10-03 20:02:06 +0000
committerIgor Sysoev <igor@sysoev.ru>2004-10-03 20:02:06 +0000
commitaad1b89b68b0651b5729b15203081f6b4620847a (patch)
tree8a5906c3607c082e27d4d8ebc1e9a9e5b42822b5 /src/core/ngx_cycle.c
parent8035fd27919d1f598b0d655a3bf30200220462d3 (diff)
downloadnginx-aad1b89b68b0651b5729b15203081f6b4620847a.tar.gz
nginx-aad1b89b68b0651b5729b15203081f6b4620847a.zip
nginx-0.1.0-2004-10-04-00:02:06 import
Diffstat (limited to 'src/core/ngx_cycle.c')
-rw-r--r--src/core/ngx_cycle.c44
1 files changed, 23 insertions, 21 deletions
diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c
index a545c61d7..ed4d60f89 100644
--- a/src/core/ngx_cycle.c
+++ b/src/core/ngx_cycle.c
@@ -328,24 +328,6 @@ ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle)
}
}
-#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 @@ ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle)
i = 0;
}
- if (file[i].fd == NGX_INVALID_FILE) {
+ if (file[i].fd == NGX_INVALID_FILE
+ || file[i].fd == ngx_stderr_fileno)
+ {
continue;
}
@@ -400,8 +384,26 @@ ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle)
/* commit the new cycle configuration */
- pool->log = cycle->log;
+#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) {
@@ -446,7 +448,7 @@ ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle)
i = 0;
}
- if (file[i].fd == NGX_INVALID_FILE) {
+ if (file[i].fd == NGX_INVALID_FILE || file[i].fd == ngx_stderr_fileno) {
continue;
}