diff src/core/ngx_file.c @ 276:c5c2b2883984 NGINX_0_5_8

nginx 0.5.8 *) Bugfix: a segmentation fault might occur if "client_body_in_file_only on" was used and a request body was small. *) Bugfix: a segmentation fault occurred if "client_body_in_file_only on" and "proxy_pass_request_body off" or "fastcgi_pass_request_body off" directives were used, and nginx switched to a next upstream. *) Bugfix: if the "proxy_buffering off" directive was used and a client connection was non-active, then the connection was closed after send timeout; bug appeared in 0.4.7. *) Bugfix: if the "epoll" method was used and a client closed a connection prematurely, then nginx closed the connection after a send timeout only. *) Bugfix: the "[alert] zero size buf" error when FastCGI server was used. *) Bugfixes in the "limit_zone" directive.
author Igor Sysoev <http://sysoev.ru>
date Fri, 19 Jan 2007 00:00:00 +0300
parents 29a6403156b0
children 704622b2528a
line wrap: on
line diff
--- a/src/core/ngx_file.c
+++ b/src/core/ngx_file.c
@@ -19,7 +19,7 @@ ngx_write_chain_to_temp_file(ngx_temp_fi
 
     if (tf->file.fd == NGX_INVALID_FILE) {
         rc = ngx_create_temp_file(&tf->file, tf->path, tf->pool,
-                                  tf->persistent, tf->mode);
+                                  tf->persistent, tf->access);
 
         if (rc == NGX_ERROR || rc == NGX_AGAIN) {
             return rc;
@@ -37,7 +37,7 @@ ngx_write_chain_to_temp_file(ngx_temp_fi
 
 ngx_int_t
 ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path, ngx_pool_t *pool,
-    ngx_uint_t persistent, ngx_uint_t mode)
+    ngx_uint_t persistent, ngx_uint_t access)
 {
     ngx_err_t                 err;
     ngx_atomic_uint_t         n;
@@ -72,7 +72,7 @@ ngx_create_temp_file(ngx_file_t *file, n
             return NGX_ERROR;
         }
 
-        file->fd = ngx_open_tempfile(file->name.data, persistent, mode);
+        file->fd = ngx_open_tempfile(file->name.data, persistent, access);
 
         ngx_log_debug1(NGX_LOG_DEBUG_CORE, file->log, 0,
                        "temp fd:%d", file->fd);
@@ -445,8 +445,8 @@ ngx_walk_tree(ngx_tree_ctx_t *ctx, ngx_s
 
     prev = ctx->data;
 
-    if (ctx->size) {
-        data = ngx_alloc(ctx->size, ctx->log);
+    if (ctx->alloc) {
+        data = ngx_alloc(ctx->alloc, ctx->log);
         if (data == NULL) {
             goto failed;
         }
@@ -529,6 +529,10 @@ ngx_walk_tree(ngx_tree_ctx_t *ctx, ngx_s
             ngx_log_debug1(NGX_LOG_DEBUG_CORE, ctx->log, 0,
                            "tree file \"%s\"", file.data);
 
+            ctx->size = ngx_de_size(&dir);
+            ctx->access = ngx_de_access(&dir);
+            ctx->mtime = ngx_de_mtime(&dir);
+
             if (ctx->file_handler(ctx, &file) == NGX_ABORT) {
                 goto failed;
             }
@@ -538,6 +542,9 @@ ngx_walk_tree(ngx_tree_ctx_t *ctx, ngx_s
             ngx_log_debug1(NGX_LOG_DEBUG_CORE, ctx->log, 0,
                            "tree enter dir \"%s\"", file.data);
 
+            ctx->access = ngx_de_access(&dir);
+            ctx->mtime = ngx_de_mtime(&dir);
+
             if (ctx->pre_tree_handler(ctx, &file) == NGX_ABORT) {
                 goto failed;
             }
@@ -546,6 +553,9 @@ ngx_walk_tree(ngx_tree_ctx_t *ctx, ngx_s
                 goto failed;
             }
 
+            ctx->access = ngx_de_access(&dir);
+            ctx->mtime = ngx_de_mtime(&dir);
+
             if (ctx->post_tree_handler(ctx, &file) == NGX_ABORT) {
                 goto failed;
             }
@@ -571,7 +581,7 @@ done:
         ngx_free(buf.data);
     }
 
-    if (ctx->data) {
+    if (ctx->alloc) {
         ngx_free(ctx->data);
         ctx->data = prev;
     }