diff src/core/ngx_open_file_cache.c @ 370:9a242235a80a NGINX_0_6_29

nginx 0.6.29 *) Feature: the ngx_google_perftools_module. *) Bugfix: the ngx_http_perl_module could be not built on 64-bit platforms; bug appeared in 0.6.27.
author Igor Sysoev <http://sysoev.ru>
date Tue, 18 Mar 2008 00:00:00 +0300
parents 9121a0a91f47
children 67fa3851697b
line wrap: on
line diff
--- a/src/core/ngx_open_file_cache.c
+++ b/src/core/ngx_open_file_cache.c
@@ -308,8 +308,6 @@ ngx_open_cached_file(ngx_open_file_cache
 
     /* not found */
 
-    file = NULL;
-
     rc = ngx_open_and_stat_file(name->data, of, pool->log);
 
     if (rc != NGX_OK && (of->err == 0 || !of->errors)) {
@@ -413,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 (file->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);