[nginx] Autoindex: improved ngx_de_info() error handling.

Sergey Kandaurov pluknet at nginx.com
Wed Aug 21 16:24:36 UTC 2013


details:   http://hg.nginx.org/nginx/rev/e8bca8397625
branches:  
changeset: 5333:e8bca8397625
user:      Sergey Kandaurov <pluknet at nginx.com>
date:      Tue Jul 30 11:43:21 2013 +0400
description:
Autoindex: improved ngx_de_info() error handling.

This allows to build a directory listing whenever a loop exists in symbolic
link resolution of the path argument.

diffstat:

 src/http/modules/ngx_http_autoindex_module.c |  2 +-
 src/os/unix/ngx_errno.h                      |  2 +-
 src/os/win32/ngx_errno.h                     |  1 +
 3 files changed, 3 insertions(+), 2 deletions(-)

diffs (38 lines):

diff -r 1a9700ef9725 -r e8bca8397625 src/http/modules/ngx_http_autoindex_module.c
--- a/src/http/modules/ngx_http_autoindex_module.c	Tue Jul 30 11:43:21 2013 +0400
+++ b/src/http/modules/ngx_http_autoindex_module.c	Tue Jul 30 11:43:21 2013 +0400
@@ -304,7 +304,7 @@ ngx_http_autoindex_handler(ngx_http_requ
             if (ngx_de_info(filename, &dir) == NGX_FILE_ERROR) {
                 err = ngx_errno;
 
-                if (err != NGX_ENOENT) {
+                if (err != NGX_ENOENT && err != NGX_ELOOP) {
                     ngx_log_error(NGX_LOG_CRIT, r->connection->log, err,
                                   ngx_de_info_n " \"%s\" failed", filename);
 
diff -r 1a9700ef9725 -r e8bca8397625 src/os/unix/ngx_errno.h
--- a/src/os/unix/ngx_errno.h	Tue Jul 30 11:43:21 2013 +0400
+++ b/src/os/unix/ngx_errno.h	Tue Jul 30 11:43:21 2013 +0400
@@ -49,10 +49,10 @@ typedef int               ngx_err_t;
 #define NGX_ECANCELED     ECANCELED
 #define NGX_EILSEQ        EILSEQ
 #define NGX_ENOMOREFILES  0
+#define NGX_ELOOP         ELOOP
 
 #if (NGX_HAVE_OPENAT)
 #define NGX_EMLINK        EMLINK
-#define NGX_ELOOP         ELOOP
 #endif
 
 #if (__hpux__)
diff -r 1a9700ef9725 -r e8bca8397625 src/os/win32/ngx_errno.h
--- a/src/os/win32/ngx_errno.h	Tue Jul 30 11:43:21 2013 +0400
+++ b/src/os/win32/ngx_errno.h	Tue Jul 30 11:43:21 2013 +0400
@@ -51,6 +51,7 @@ typedef DWORD                      ngx_e
 #define NGX_EHOSTUNREACH           WSAEHOSTUNREACH
 #define NGX_ENOMOREFILES           ERROR_NO_MORE_FILES
 #define NGX_EILSEQ                 ERROR_NO_UNICODE_TRANSLATION
+#define NGX_ELOOP                  0
 
 #define NGX_EALREADY               WSAEALREADY
 #define NGX_EINVAL                 WSAEINVAL



More information about the nginx-devel mailing list