Mercurial > hg > nginx
diff src/http/modules/ngx_http_log_module.c @ 4984:7737f0d788c1
Access log: fixed redundant buffer reallocation.
Previously a new buffer was allocated for every "access_log" directive with the
same file path and "buffer=" parameters, while only one buffer per file is used.
author | Valentin Bartenev <vbart@nginx.com> |
---|---|
date | Sun, 23 Dec 2012 15:27:55 +0000 |
parents | e89bd9896fea |
children | a0599b56e748 |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_log_module.c Sat Dec 22 20:03:38 2012 +0000 +++ b/src/http/modules/ngx_http_log_module.c Sun Dec 23 15:27:55 2012 +0000 @@ -970,11 +970,15 @@ return NGX_CONF_ERROR; } - if (log->file->buffer && log->file->last - log->file->pos != buf) { - ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, - "access_log \"%V\" already defined " - "with different buffer size", &value[1]); - return NGX_CONF_ERROR; + if (log->file->buffer) { + if (log->file->last - log->file->pos != buf) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "access_log \"%V\" already defined " + "with different buffer size", &value[1]); + return NGX_CONF_ERROR; + } + + return NGX_CONF_OK; } log->file->buffer = ngx_palloc(cf->pool, buf);