]> git.kaiwu.me - nginx.git/commitdiff
Autoindex: improved ngx_de_info() error handling.
authorSergey Kandaurov <pluknet@nginx.com>
Tue, 30 Jul 2013 07:43:21 +0000 (11:43 +0400)
committerSergey Kandaurov <pluknet@nginx.com>
Tue, 30 Jul 2013 07:43:21 +0000 (11:43 +0400)
This allows to build a directory listing whenever a loop exists in symbolic
link resolution of the path argument.

src/http/modules/ngx_http_autoindex_module.c
src/os/unix/ngx_errno.h
src/os/win32/ngx_errno.h

index 222ac728c2481afdf9f75fc9f8b0e803e04f12c3..1eecfbe689c4159e2417ba0076c1d7cf732ff150 100644 (file)
@@ -304,7 +304,7 @@ ngx_http_autoindex_handler(ngx_http_request_t *r)
             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);
 
index 125087e781d7c12e700477f499bbf7c5b35dac08..1497c5f2f35456a3f4bc3f0d7d294bcfacae2b89 100644 (file)
@@ -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__)
index 090ba1b530efe38806fba59ba074751fe509af3a..decb6fef0419e804c4c8155aefacd0b05a528632 100644 (file)
@@ -51,6 +51,7 @@ typedef DWORD                      ngx_err_t;
 #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