changeset 1937:c46432b9dbb7

fix case when errors are not cached, and a file was not used often enough to keep open and it has been removed before it was kept open
author Igor Sysoev <igor@sysoev.ru>
date Thu, 13 Mar 2008 12:59:25 +0000
parents e829527ca810
children ed71d58c0cf3
files src/core/ngx_open_file_cache.c
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/core/ngx_open_file_cache.c
+++ b/src/core/ngx_open_file_cache.c
@@ -411,9 +411,11 @@ failed:
 
         cache->current--;
 
-        if (ngx_close_file(file->fd) == NGX_FILE_ERROR) {
-            ngx_log_error(NGX_LOG_ALERT, pool->log, ngx_errno,
-                          ngx_close_file_n " \"%s\" failed", file->name);
+        if (of->fd != NGX_INVALID_FILE) {
+            if (ngx_close_file(file->fd) == NGX_FILE_ERROR) {
+                ngx_log_error(NGX_LOG_ALERT, pool->log, ngx_errno,
+                              ngx_close_file_n " \"%s\" failed", file->name);
+            }
         }
 
         ngx_free(file->name);