comparison src/http/modules/perl/nginx.xs @ 2063:67a29af877ed

initialize of.uniq in ngx_open_cached_file()
author Igor Sysoev <igor@sysoev.ru>
date Mon, 23 Jun 2008 13:35:34 +0000
parents b0a1c84725cf
children 75a8d34459c5
comparison
equal deleted inserted replaced
2062:90312b616162 2063:67a29af877ed
637 b->file = ngx_pcalloc(r->pool, sizeof(ngx_file_t)); 637 b->file = ngx_pcalloc(r->pool, sizeof(ngx_file_t));
638 if (b->file == NULL) { 638 if (b->file == NULL) {
639 XSRETURN_EMPTY; 639 XSRETURN_EMPTY;
640 } 640 }
641 641
642 path.len = ngx_strlen(filename);
643
644 path.data = ngx_pnalloc(r->pool, path.len + 1);
645 if (path.data == NULL) {
646 XSRETURN_EMPTY;
647 }
648
649 (void) ngx_cpystrn(path.data, filename, path.len + 1);
650
642 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); 651 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
643 652
653 of.uniq = 0;
644 of.test_dir = 0; 654 of.test_dir = 0;
645 of.valid = clcf->open_file_cache_valid; 655 of.valid = clcf->open_file_cache_valid;
646 of.min_uses = clcf->open_file_cache_min_uses; 656 of.min_uses = clcf->open_file_cache_min_uses;
647 of.errors = clcf->open_file_cache_errors; 657 of.errors = clcf->open_file_cache_errors;
648 of.events = clcf->open_file_cache_events; 658 of.events = clcf->open_file_cache_events;
649
650 path.len = ngx_strlen(filename);
651
652 path.data = ngx_pnalloc(r->pool, path.len + 1);
653 if (path.data == NULL) {
654 XSRETURN_EMPTY;
655 }
656
657 (void) ngx_cpystrn(path.data, filename, path.len + 1);
658 659
659 if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool) 660 if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
660 != NGX_OK) 661 != NGX_OK)
661 { 662 {
662 if (of.err == 0) { 663 if (of.err == 0) {