# HG changeset patch
# User Maxim Dounin <mdou...@mdounin.ru>
# Date 1748208427 -10800
#      Mon May 26 00:27:07 2025 +0300
# Node ID f84080a83901176c0dd95681b19290f070de045c
# Parent  8cc90a3e3e74d31a92b2732f6f4003684a011fcd
Open file cache: disable_symlinks with open_file_cache_events.

Previously, different disable_symlinks settings were respected when
retrieving a file from open file cache when using periodic retest, but
were ignored with using open_file_cache_events.

Fix is to test disable_symlinks settings in all cases, and retest the
file if requested settings are different from what we already have in
the cache.

diff --git a/src/core/ngx_open_file_cache.c b/src/core/ngx_open_file_cache.c
--- a/src/core/ngx_open_file_cache.c
+++ b/src/core/ngx_open_file_cache.c
@@ -227,15 +227,15 @@ ngx_open_cached_file(ngx_open_file_cache
             goto add_event;
         }
 
-        if (file->use_event
-            || (file->event == NULL
-                && (of->uniq == 0 || of->uniq == file->uniq)
-                && now - file->created < of->valid
+        if ((file->use_event
+             || (file->event == NULL
+                 && (of->uniq == 0 || of->uniq == file->uniq)
+                 && now - file->created < of->valid))
 #if (NGX_HAVE_OPENAT)
-                && of->disable_symlinks == file->disable_symlinks
-                && of->disable_symlinks_from == file->disable_symlinks_from
+            && of->disable_symlinks == file->disable_symlinks
+            && of->disable_symlinks_from == file->disable_symlinks_from
 #endif
-            ))
+            )
         {
             if (file->err == 0) {
 

Reply via email to