Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Homutov <vl@nginx.com>2014-07-24 16:25:07 +0400
committerVladimir Homutov <vl@nginx.com>2014-07-24 16:25:07 +0400
commitc54899ddfd9d517b01e09fc3e57b497a8f019686 (patch)
treeca9b4be2a1517585ef66db1dc2ce2e25e70db07d /src/core/ngx_log.c
parent248baf4262c6957b324aad4711dfcb681d4fa23d (diff)
Core: fixed default log initialization.
The ngx_log_insert() function may invalidate pointer passed to it, so make sure to don't use it after the ngx_log_insert() call.
Diffstat (limited to 'src/core/ngx_log.c')
-rw-r--r--src/core/ngx_log.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/core/ngx_log.c b/src/core/ngx_log.c
index 375d52f65..005d9ff88 100644
--- a/src/core/ngx_log.c
+++ b/src/core/ngx_log.c
@@ -387,20 +387,22 @@ ngx_log_open_default(ngx_cycle_t *cycle)
return NGX_ERROR;
}
- log->log_level = NGX_LOG_ERR;
- ngx_log_insert(&cycle->new_log, log);
-
} else {
/* no error logs at all */
log = &cycle->new_log;
- log->log_level = NGX_LOG_ERR;
}
+ log->log_level = NGX_LOG_ERR;
+
log->file = ngx_conf_open_file(cycle, &error_log);
if (log->file == NULL) {
return NGX_ERROR;
}
+ if (log != &cycle->new_log) {
+ ngx_log_insert(&cycle->new_log, log);
+ }
+
return NGX_OK;
}