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:
Diffstat (limited to 'src/core/nginx.c')
-rw-r--r--src/core/nginx.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/core/nginx.c b/src/core/nginx.c
index 920b60163..236a65b0f 100644
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -95,6 +95,8 @@ ngx_module_t ngx_core_module = {
ngx_uint_t ngx_max_module;
+ngx_uint_t ngx_use_stderr;
+
int main(int argc, char *const *argv)
{
@@ -116,9 +118,10 @@ int main(int argc, char *const *argv)
ngx_regex_init();
#endif
- log = ngx_log_init_errlog();
ngx_pid = ngx_getpid();
+ log = ngx_log_init_errlog();
+
#if (NGX_OPENSSL)
ngx_ssl_init(log);
#endif
@@ -133,15 +136,19 @@ int main(int argc, char *const *argv)
ctx.argc = argc;
ctx.argv = argv;
- if (ngx_os_init(log) == NGX_ERROR) {
+ if (!(init_cycle.pool = ngx_create_pool(1024, log))) {
return 1;
}
- if (!(init_cycle.pool = ngx_create_pool(1024, log))) {
+ if (ngx_getopt(&ctx, &init_cycle) == NGX_ERROR) {
return 1;
}
- if (ngx_getopt(&ctx, &init_cycle) == NGX_ERROR) {
+ if (ngx_use_stderr) {
+ log = ngx_log_init_errlog();
+ }
+
+ if (ngx_os_init(log) == NGX_ERROR) {
return 1;
}
@@ -319,6 +326,10 @@ static ngx_int_t ngx_getopt(ngx_master_ctx_t *ctx, ngx_cycle_t *cycle)
ngx_test_config = 1;
break;
+ case 's':
+ ngx_use_stderr = 1;
+ break;
+
case 'c':
if (ctx->argv[i + 1] == NULL) {
ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,