diff src/http/modules/ngx_http_limit_zone_module.c @ 2611:2bce3f6416c6

improve ngx_slab_alloc() error logging
author Igor Sysoev <igor@sysoev.ru>
date Fri, 27 Mar 2009 17:00:42 +0000
parents f4603d71f532
children 038dc63b657a
line wrap: on
line diff
--- a/src/http/modules/ngx_http_limit_zone_module.c
+++ b/src/http/modules/ngx_http_limit_zone_module.c
@@ -321,6 +321,7 @@ ngx_http_limit_zone_init_zone(ngx_shm_zo
 {
     ngx_http_limit_zone_ctx_t  *octx = data;
 
+    size_t                      len;
     ngx_slab_pool_t            *shpool;
     ngx_rbtree_node_t          *sentinel;
     ngx_http_limit_zone_ctx_t  *ctx;
@@ -356,6 +357,15 @@ ngx_http_limit_zone_init_zone(ngx_shm_zo
     ngx_rbtree_init(ctx->rbtree, sentinel,
                     ngx_http_limit_zone_rbtree_insert_value);
 
+    len = sizeof(" in limit_zone \"\"") + shm_zone->name.len;
+
+    shpool->log_ctx = ngx_slab_alloc(shpool, len);
+    if (shpool->log_ctx == NULL) {
+        return NGX_ERROR;
+    }
+
+    ngx_sprintf(shpool->log_ctx, " in limit_zone \"%V\"%Z", &shm_zone->name);
+
     return NGX_OK;
 }