Welcome! Log In Create A New Profile

Advanced

[nginx] Core: fixed default log initialization.

Homutov Vladimir
July 24, 2014 08:28AM
details: http://hg.nginx.org/nginx/rev/c3b08217f2a2
branches:
changeset: 5771:c3b08217f2a2
user: Vladimir Homutov <vl@nginx.com>
date: Thu Jul 24 16:25:07 2014 +0400
description:
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:

src/core/ngx_log.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)

diffs (30 lines):

diff -r 9de5820bb3e0 -r c3b08217f2a2 src/core/ngx_log.c
--- a/src/core/ngx_log.c Fri Jul 18 20:11:40 2014 +0400
+++ b/src/core/ngx_log.c Thu Jul 24 16:25:07 2014 +0400
@@ -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;
}


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

[nginx] Core: fixed default log initialization.

Homutov Vladimir 649 July 24, 2014 08:28AM



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

Online Users

Guests: 300
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready