aboutsummaryrefslogtreecommitdiff
path: root/src/core/nginx.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/nginx.c')
-rw-r--r--src/core/nginx.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/core/nginx.c b/src/core/nginx.c
index 1de6e3258..fd2f2db03 100644
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -61,7 +61,20 @@ int main(int argc, char *const *argv)
ngx_cycle = cycle;
- /* daemon */
+#if !(WIN32)
+
+ if (0) {
+ if (ngx_daemon(cycle->log) == NGX_ERROR) {
+ return 1;
+ }
+ }
+
+ if (dup2(cycle->log->file->fd, STDERR_FILENO) == -1) {
+ ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "dup2(STDERR) failed");
+ return 1;
+ }
+
+#endif
/* life cycle */
@@ -154,7 +167,7 @@ static ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle, ngx_log_t *log)
cycle->open_files.nalloc = n;
cycle->open_files.pool = pool;
- cycle->log = ngx_log_create_errlog(cycle);
+ cycle->log = ngx_log_create_errlog(cycle, NULL);
if (cycle->log == NULL) {
ngx_destroy_pool(pool);
return NULL;