[nginx] Core: supported directory skipping in ngx_walk_tree().

Roman Arutyunyan arut at nginx.com
Mon Feb 2 16:40:37 UTC 2015


details:   http://hg.nginx.org/nginx/rev/863d9de1e62b
branches:  
changeset: 5967:863d9de1e62b
user:      Roman Arutyunyan <arut at nginx.com>
date:      Mon Feb 02 19:38:32 2015 +0300
description:
Core: supported directory skipping in ngx_walk_tree().

If pre_tree_handler() returns NGX_DECLINED, the directory is ignored.

diffstat:

 src/core/ngx_file.c |  10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diffs (23 lines):

diff -r bcdfc39bf44d -r 863d9de1e62b src/core/ngx_file.c
--- a/src/core/ngx_file.c	Wed Jan 28 21:33:06 2015 +0300
+++ b/src/core/ngx_file.c	Mon Feb 02 19:38:32 2015 +0300
@@ -1047,10 +1047,18 @@ ngx_walk_tree(ngx_tree_ctx_t *ctx, ngx_s
             ctx->access = ngx_de_access(&dir);
             ctx->mtime = ngx_de_mtime(&dir);
 
-            if (ctx->pre_tree_handler(ctx, &file) == NGX_ABORT) {
+            rc = ctx->pre_tree_handler(ctx, &file);
+
+            if (rc == NGX_ABORT) {
                 goto failed;
             }
 
+            if (rc == NGX_DECLINED) {
+                ngx_log_debug1(NGX_LOG_DEBUG_CORE, ctx->log, 0,
+                               "tree skip dir \"%s\"", file.data);
+                continue;
+            }
+
             if (ngx_walk_tree(ctx, &file) == NGX_ABORT) {
                 goto failed;
             }



More information about the nginx-devel mailing list