comparison src/core/ngx_file.c @ 112:408f195b3482 NGINX_0_3_3

nginx 0.3.3 *) Change: the "bl" and "af" parameters of the "listen" directive was renamed to the "backlog" and "accept_filter". *) Feature: the "rcvbuf" and "sndbuf" parameters of the "listen" directive. *) Change: the "$msec" log parameter does not require now the additional the gettimeofday() system call. *) Feature: the -t switch now tests the "listen" directives. *) Bugfix: if the invalid address was specified in the "listen" directive, then after the -HUP signal nginx left an open socket in the CLOSED state. *) Bugfix: the mime type may be incorrectly set to default value for index file with variable in the name; bug appeared in 0.3.0. *) Feature: the "timer_resolution" directive. *) Feature: the millisecond "$upstream_response_time" log parameter. *) Bugfix: a temporary file with client request body now is removed just after the response header was transferred to a client. *) Bugfix: OpenSSL 0.9.6 compatibility. *) Bugfix: the SSL certificate and key file paths could not be relative. *) Bugfix: the "ssl_prefer_server_ciphers" directive did not work in the ngx_imap_ssl_module. *) Bugfix: the "ssl_protocols" directive allowed to specify the single protocol only.
author Igor Sysoev <http://sysoev.ru>
date Wed, 19 Oct 2005 00:00:00 +0400
parents dad2fe8ecf08
children 87699398f955
comparison
equal deleted inserted replaced
111:a175b609c76d 112:408f195b3482
38 ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path, ngx_pool_t *pool, 38 ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path, ngx_pool_t *pool,
39 ngx_uint_t persistent) 39 ngx_uint_t persistent)
40 { 40 {
41 ngx_err_t err; 41 ngx_err_t err;
42 ngx_atomic_uint_t n; 42 ngx_atomic_uint_t n;
43 ngx_pool_cleanup_file_t *cln; 43 ngx_pool_cleanup_t *cln;
44 44 ngx_pool_cleanup_file_t *clnf;
45 45
46 file->name.len = path->name.len + 1 + path->len + NGX_ATOMIC_T_LEN; 46 file->name.len = path->name.len + 1 + path->len + NGX_ATOMIC_T_LEN;
47 47
48 file->name.data = ngx_palloc(pool, file->name.len + 1); 48 file->name.data = ngx_palloc(pool, file->name.len + 1);
49 if (file->name.data == NULL) { 49 if (file->name.data == NULL) {
63 for ( ;; ) { 63 for ( ;; ) {
64 (void) ngx_sprintf(file->name.data + path->name.len + 1 + path->len, 64 (void) ngx_sprintf(file->name.data + path->name.len + 1 + path->len,
65 "%0muA%Z", n); 65 "%0muA%Z", n);
66 66
67 ngx_create_hashed_filename(file, path); 67 ngx_create_hashed_filename(file, path);
68
69 cln = ngx_pool_cleanup_add(pool, sizeof(ngx_pool_cleanup_file_t));
70 if (cln == NULL) {
71 return NGX_ERROR;
72 }
68 73
69 #if 1 74 #if 1
70 file->fd = ngx_open_tempfile(file->name.data, persistent); 75 file->fd = ngx_open_tempfile(file->name.data, persistent);
71 #else 76 #else
72 file->fd = ngx_open_tempfile(file->name.data, 1); 77 file->fd = ngx_open_tempfile(file->name.data, 1);
74 79
75 ngx_log_debug1(NGX_LOG_DEBUG_CORE, file->log, 0, 80 ngx_log_debug1(NGX_LOG_DEBUG_CORE, file->log, 0,
76 "temp fd:%d", file->fd); 81 "temp fd:%d", file->fd);
77 82
78 if (file->fd != NGX_INVALID_FILE) { 83 if (file->fd != NGX_INVALID_FILE) {
79 cln = ngx_palloc(pool, sizeof(ngx_pool_cleanup_file_t)); 84
80 if (cln == NULL) { 85 cln->handler = ngx_pool_cleanup_file;
81 return NGX_ERROR; 86 clnf = cln->data;
82 } 87
83 88 clnf->fd = file->fd;
84 cln->fd = file->fd; 89 clnf->name = file->name.data;
85 cln->name = file->name.data; 90 clnf->log = pool->log;
86 cln->log = pool->log;
87
88 if (ngx_pool_cleanup_add(pool, ngx_pool_cleanup_file, cln) == NULL)
89 {
90 return NGX_ERROR;
91 }
92 91
93 return NGX_OK; 92 return NGX_OK;
94 } 93 }
95 94
96 err = ngx_errno; 95 err = ngx_errno;