Welcome! Log In Create A New Profile

Advanced

[nginx] Core: fixed stderr redirection on win32 in ngx_reopen_fi...

Homutov Vladimir
June 04, 2013 11:34AM
details: http://hg.nginx.org/nginx/rev/85e72ea8fbfd
branches:
changeset: 5239:85e72ea8fbfd
user: Vladimir Homutov <vl@nginx.com>
date: Mon Jun 03 16:54:28 2013 +0400
description:
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:

src/core/ngx_cycle.c | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)

diffs (24 lines):

diff -r a15e2ef8d73d -r 85e72ea8fbfd src/core/ngx_cycle.c
--- a/src/core/ngx_cycle.c Tue Jun 04 17:21:52 2013 +0400
+++ b/src/core/ngx_cycle.c Mon Jun 03 16:54:28 2013 +0400
@@ -1228,16 +1228,13 @@ ngx_reopen_files(ngx_cycle_t *cycle, ngx
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
}



_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Core: fixed stderr redirection on win32 in ngx_reopen_fi...

Homutov Vladimir 728 June 04, 2013 11:34AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 161
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready