]> git.kaiwu.me - nginx.git/commitdiff
Access log: fixed redundant buffer reallocation.
authorValentin Bartenev <vbart@nginx.com>
Sun, 23 Dec 2012 15:27:55 +0000 (15:27 +0000)
committerValentin Bartenev <vbart@nginx.com>
Sun, 23 Dec 2012 15:27:55 +0000 (15:27 +0000)
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.

src/http/modules/ngx_http_log_module.c

index 0962c8475be35d9a66ac8e48cd6f60838c56b2a0..69dd59bf9dfe77645bcebd3bd39e7e4e132df237 100644 (file)
@@ -970,11 +970,15 @@ buffer:
             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);