Mercurial > hg > nginx
comparison src/core/ngx_file.c @ 1058:01f818c6f7de
add size, access, and mtime to ngx_walk_tree()
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 18 Jan 2007 21:04:31 +0000 |
parents | bb139aba3199 |
children | 4d203f76b757 |
comparison
equal
deleted
inserted
replaced
1057:bbde03037ef6 | 1058:01f818c6f7de |
---|---|
443 return NGX_ERROR; | 443 return NGX_ERROR; |
444 } | 444 } |
445 | 445 |
446 prev = ctx->data; | 446 prev = ctx->data; |
447 | 447 |
448 if (ctx->size) { | 448 if (ctx->alloc) { |
449 data = ngx_alloc(ctx->size, ctx->log); | 449 data = ngx_alloc(ctx->alloc, ctx->log); |
450 if (data == NULL) { | 450 if (data == NULL) { |
451 goto failed; | 451 goto failed; |
452 } | 452 } |
453 | 453 |
454 if (ctx->init_handler(data, prev) == NGX_ABORT) { | 454 if (ctx->init_handler(data, prev) == NGX_ABORT) { |
527 if (ngx_de_is_file(&dir)) { | 527 if (ngx_de_is_file(&dir)) { |
528 | 528 |
529 ngx_log_debug1(NGX_LOG_DEBUG_CORE, ctx->log, 0, | 529 ngx_log_debug1(NGX_LOG_DEBUG_CORE, ctx->log, 0, |
530 "tree file \"%s\"", file.data); | 530 "tree file \"%s\"", file.data); |
531 | 531 |
532 ctx->size = ngx_de_size(&dir); | |
533 ctx->access = ngx_de_access(&dir); | |
534 ctx->mtime = ngx_de_mtime(&dir); | |
535 | |
532 if (ctx->file_handler(ctx, &file) == NGX_ABORT) { | 536 if (ctx->file_handler(ctx, &file) == NGX_ABORT) { |
533 goto failed; | 537 goto failed; |
534 } | 538 } |
535 | 539 |
536 } else if (ngx_de_is_dir(&dir)) { | 540 } else if (ngx_de_is_dir(&dir)) { |
537 | 541 |
538 ngx_log_debug1(NGX_LOG_DEBUG_CORE, ctx->log, 0, | 542 ngx_log_debug1(NGX_LOG_DEBUG_CORE, ctx->log, 0, |
539 "tree enter dir \"%s\"", file.data); | 543 "tree enter dir \"%s\"", file.data); |
540 | 544 |
545 ctx->access = ngx_de_access(&dir); | |
546 ctx->mtime = ngx_de_mtime(&dir); | |
547 | |
541 if (ctx->pre_tree_handler(ctx, &file) == NGX_ABORT) { | 548 if (ctx->pre_tree_handler(ctx, &file) == NGX_ABORT) { |
542 goto failed; | 549 goto failed; |
543 } | 550 } |
544 | 551 |
545 if (ngx_walk_tree(ctx, &file) == NGX_ABORT) { | 552 if (ngx_walk_tree(ctx, &file) == NGX_ABORT) { |
546 goto failed; | 553 goto failed; |
547 } | 554 } |
548 | 555 |
556 ctx->access = ngx_de_access(&dir); | |
557 ctx->mtime = ngx_de_mtime(&dir); | |
558 | |
549 if (ctx->post_tree_handler(ctx, &file) == NGX_ABORT) { | 559 if (ctx->post_tree_handler(ctx, &file) == NGX_ABORT) { |
550 goto failed; | 560 goto failed; |
551 } | 561 } |
552 | 562 |
553 } else { | 563 } else { |
569 | 579 |
570 if (buf.len) { | 580 if (buf.len) { |
571 ngx_free(buf.data); | 581 ngx_free(buf.data); |
572 } | 582 } |
573 | 583 |
574 if (ctx->data) { | 584 if (ctx->alloc) { |
575 ngx_free(ctx->data); | 585 ngx_free(ctx->data); |
576 ctx->data = prev; | 586 ctx->data = prev; |
577 } | 587 } |
578 | 588 |
579 if (ngx_close_dir(&dir) == NGX_ERROR) { | 589 if (ngx_close_dir(&dir) == NGX_ERROR) { |