aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorVladimir Homutov <vl@nginx.com>2013-06-03 16:54:28 +0400
committerVladimir Homutov <vl@nginx.com>2013-06-03 16:54:28 +0400
commit9db2eddd8ad9da27a68e4551fbb78ccd79470b6c (patch)
tree9af48557f03d2e41ef23ca756ac9b7e9bed1d86a /src/core
parent43b2e07b963e2e4a9d9cbc0be6d858544bb2561f (diff)
downloadnginx-9db2eddd8ad9da27a68e4551fbb78ccd79470b6c.tar.gz
nginx-9db2eddd8ad9da27a68e4551fbb78ccd79470b6c.zip
Core: fixed stderr redirection on win32 in ngx_reopen_files().
On win32 stderr was not redirected into a file specified by "error_log" while reopening files. Fix is to use platform-independent functions to work with stderr, as already used by ngx_init_cycle() and main() since rev. d8316f307b6a.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/ngx_cycle.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c
index 87b6d7daa..40b8562b4 100644
--- a/src/core/ngx_cycle.c
+++ b/src/core/ngx_cycle.c
@@ -1228,16 +1228,13 @@ ngx_reopen_files(ngx_cycle_t *cycle, ngx_uid_t user)
file[i].fd = fd;
}
-#if !(NGX_WIN32)
+ if (cycle->log->file->fd != ngx_stderr) {
- if (cycle->log->file->fd != STDERR_FILENO) {
- if (dup2(cycle->log->file->fd, STDERR_FILENO) == -1) {
- ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
- "dup2(STDERR) failed");
+ if (ngx_set_stderr(cycle->log->file->fd) == NGX_FILE_ERROR) {
+ ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
+ ngx_set_stderr_n " failed");
}
}
-
-#endif
}