comparison src/core/ngx_cycle.c @ 5239:85e72ea8fbfd

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.
author Vladimir Homutov <vl@nginx.com>
date Mon, 03 Jun 2013 16:54:28 +0400
parents f941cf265cc5
children d8af1005e886
comparison
equal deleted inserted replaced
5238:a15e2ef8d73d 5239:85e72ea8fbfd
1226 } 1226 }
1227 1227
1228 file[i].fd = fd; 1228 file[i].fd = fd;
1229 } 1229 }
1230 1230
1231 #if !(NGX_WIN32) 1231 if (cycle->log->file->fd != ngx_stderr) {
1232 1232
1233 if (cycle->log->file->fd != STDERR_FILENO) { 1233 if (ngx_set_stderr(cycle->log->file->fd) == NGX_FILE_ERROR) {
1234 if (dup2(cycle->log->file->fd, STDERR_FILENO) == -1) { 1234 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
1235 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, 1235 ngx_set_stderr_n " failed");
1236 "dup2(STDERR) failed"); 1236 }
1237 } 1237 }
1238 }
1239
1240 #endif
1241 } 1238 }
1242 1239
1243 1240
1244 ngx_shm_zone_t * 1241 ngx_shm_zone_t *
1245 ngx_shared_memory_add(ngx_conf_t *cf, ngx_str_t *name, size_t size, void *tag) 1242 ngx_shared_memory_add(ngx_conf_t *cf, ngx_str_t *name, size_t size, void *tag)