[nginx] svn commit: r4985 - trunk/src/http/modules

vbart at nginx.com vbart at nginx.com
Sun Dec 23 15:27:56 UTC 2012


Author: vbart
Date: 2012-12-23 15:27:55 +0000 (Sun, 23 Dec 2012)
New Revision: 4985
URL: http://trac.nginx.org/nginx/changeset/4985/nginx

Log:
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.



Modified:
   trunk/src/http/modules/ngx_http_log_module.c

Modified: trunk/src/http/modules/ngx_http_log_module.c
===================================================================
--- trunk/src/http/modules/ngx_http_log_module.c	2012-12-22 20:03:38 UTC (rev 4984)
+++ trunk/src/http/modules/ngx_http_log_module.c	2012-12-23 15:27:55 UTC (rev 4985)
@@ -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);



More information about the nginx-devel mailing list