comparison src/core/ngx_open_file_cache.c @ 482:392c16f2d858 NGINX_0_7_53

nginx 0.7.53 *) Change: now a log set by --error-log-path is created from the very start-up. *) Feature: now the start up errors and warnings are outputted to an error_log and stderr. *) Feature: the empty --prefix= configure parameter forces nginx to use a directory where it was run as prefix. *) Feature: the -p switch. *) Feature: the -s switch on Unix platforms. *) Feature: the -? and -h switches. Thanks to Jerome Loyet. *) Feature: now switches may be set in condensed form. *) Bugfix: nginx/Windows did not work if configuration file was given by the -c switch. *) Bugfix: temporary files might be not removed if the "proxy_store", "fastcgi_store", "proxy_cache", or "fastcgi_cache" were used. Thanks to Maxim Dounin. *) Bugfix: an incorrect value was passed to mail proxy authentication server in "Auth-Method" header line; the bug had appeared in 0.7.34. Thanks to Simon Lecaille. *) Bugfix: system error text descriptions were not logged on Linux; the bug had appeared in 0.7.45. *) Bugfix: the "fastcgi_cache_min_uses" directive did not work. Thanks to Andrew Vorobyoff.
author Igor Sysoev <http://sysoev.ru>
date Mon, 27 Apr 2009 00:00:00 +0400
parents 6866b490272e
children ed5e10fb40fc
comparison
equal deleted inserted replaced
481:0c98173187ac 482:392c16f2d858
128 ngx_open_file_info_t *of, ngx_pool_t *pool) 128 ngx_open_file_info_t *of, ngx_pool_t *pool)
129 { 129 {
130 time_t now; 130 time_t now;
131 uint32_t hash; 131 uint32_t hash;
132 ngx_int_t rc; 132 ngx_int_t rc;
133 ngx_file_info_t fi;
133 ngx_pool_cleanup_t *cln; 134 ngx_pool_cleanup_t *cln;
134 ngx_cached_open_file_t *file; 135 ngx_cached_open_file_t *file;
135 ngx_pool_cleanup_file_t *clnf; 136 ngx_pool_cleanup_file_t *clnf;
136 ngx_open_file_cache_cleanup_t *ofcln; 137 ngx_open_file_cache_cleanup_t *ofcln;
137 138
138 of->fd = NGX_INVALID_FILE; 139 of->fd = NGX_INVALID_FILE;
139 of->err = 0; 140 of->err = 0;
140 141
141 if (cache == NULL) { 142 if (cache == NULL) {
143
144 if (of->test_only) {
145
146 if (ngx_file_info(name->data, &fi) == -1) {
147 of->err = ngx_errno;
148 of->failed = ngx_file_info_n;
149 return NGX_ERROR;
150 }
151
152 of->uniq = ngx_file_uniq(&fi);
153 of->mtime = ngx_file_mtime(&fi);
154 of->size = ngx_file_size(&fi);
155 of->is_dir = ngx_is_dir(&fi);
156 of->is_file = ngx_is_file(&fi);
157 of->is_link = ngx_is_link(&fi);
158 of->is_exec = ngx_is_exec(&fi);
159
160 return NGX_OK;
161 }
142 162
143 cln = ngx_pool_cleanup_add(pool, sizeof(ngx_pool_cleanup_file_t)); 163 cln = ngx_pool_cleanup_add(pool, sizeof(ngx_pool_cleanup_file_t));
144 if (cln == NULL) { 164 if (cln == NULL) {
145 return NGX_ERROR; 165 return NGX_ERROR;
146 } 166 }
442 ngx_file_info_t fi; 462 ngx_file_info_t fi;
443 463
444 if (of->fd != NGX_INVALID_FILE) { 464 if (of->fd != NGX_INVALID_FILE) {
445 465
446 if (ngx_file_info(name, &fi) == -1) { 466 if (ngx_file_info(name, &fi) == -1) {
467 of->failed = ngx_file_info_n;
447 goto failed; 468 goto failed;
448 } 469 }
449 470
450 if (of->uniq == ngx_file_uniq(&fi)) { 471 if (of->uniq == ngx_file_uniq(&fi)) {
451 goto done; 472 goto done;
452 } 473 }
453 474
454 } else if (of->test_dir) { 475 } else if (of->test_dir) {
455 476
456 if (ngx_file_info(name, &fi) == -1) { 477 if (ngx_file_info(name, &fi) == -1) {
478 of->failed = ngx_file_info_n;
457 goto failed; 479 goto failed;
458 } 480 }
459 481
460 if (ngx_is_dir(&fi)) { 482 if (ngx_is_dir(&fi)) {
461 goto done; 483 goto done;
469 fd = ngx_open_file(name, NGX_FILE_APPEND, NGX_FILE_CREATE_OR_OPEN, 491 fd = ngx_open_file(name, NGX_FILE_APPEND, NGX_FILE_CREATE_OR_OPEN,
470 NGX_FILE_DEFAULT_ACCESS); 492 NGX_FILE_DEFAULT_ACCESS);
471 } 493 }
472 494
473 if (fd == NGX_INVALID_FILE) { 495 if (fd == NGX_INVALID_FILE) {
496 of->failed = ngx_open_file_n;
474 goto failed; 497 goto failed;
475 } 498 }
476 499
477 if (ngx_fd_info(fd, &fi) == NGX_FILE_ERROR) { 500 if (ngx_fd_info(fd, &fi) == NGX_FILE_ERROR) {
478 ngx_log_error(NGX_LOG_CRIT, log, ngx_errno, 501 ngx_log_error(NGX_LOG_CRIT, log, ngx_errno,