comparison src/core/ngx_file.c @ 282:675a39fd14cd NGINX_0_5_11

nginx 0.5.11 *) Feature: now configure detects system PCRE library in MacPorts. Thanks to Chris McGrath. *) Bugfix: the response was incorrect if several ranges were requested; bug appeared in 0.5.6. *) Bugfix: the "create_full_put_path" directive could not create the intermediate directories if no "dav_access" directive was set. Thanks to Evan Miller. *) Bugfix: the "0" response code might be logged in the access_log instead of the "400" and "408" error codes. *) Bugfix: a segmentation fault might occur in worker process if nginx was built with -O2 optimization.
author Igor Sysoev <http://sysoev.ru>
date Mon, 05 Feb 2007 00:00:00 +0300
parents 704622b2528a
children fc223117327f
comparison
equal deleted inserted replaced
281:5338da501733 282:675a39fd14cd
37 37
38 ngx_int_t 38 ngx_int_t
39 ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path, ngx_pool_t *pool, 39 ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path, ngx_pool_t *pool,
40 ngx_uint_t persistent, ngx_uint_t clean, ngx_uint_t access) 40 ngx_uint_t persistent, ngx_uint_t clean, ngx_uint_t access)
41 { 41 {
42 uint32_t n;
42 ngx_err_t err; 43 ngx_err_t err;
43 ngx_atomic_uint_t n;
44 ngx_pool_cleanup_t *cln; 44 ngx_pool_cleanup_t *cln;
45 ngx_pool_cleanup_file_t *clnf; 45 ngx_pool_cleanup_file_t *clnf;
46 46
47 file->name.len = path->name.len + 1 + path->len + NGX_ATOMIC_T_LEN; 47 file->name.len = path->name.len + 1 + path->len + 10;
48 48
49 file->name.data = ngx_palloc(pool, file->name.len + 1); 49 file->name.data = ngx_palloc(pool, file->name.len + 1);
50 if (file->name.data == NULL) { 50 if (file->name.data == NULL) {
51 return NGX_ERROR; 51 return NGX_ERROR;
52 } 52 }
57 } 57 }
58 #endif 58 #endif
59 59
60 ngx_memcpy(file->name.data, path->name.data, path->name.len); 60 ngx_memcpy(file->name.data, path->name.data, path->name.len);
61 61
62 n = ngx_next_temp_number(0); 62 n = (uint32_t) ngx_next_temp_number(0);
63 63
64 for ( ;; ) { 64 for ( ;; ) {
65 (void) ngx_sprintf(file->name.data + path->name.len + 1 + path->len, 65 (void) ngx_sprintf(file->name.data + path->name.len + 1 + path->len,
66 "%0muA%Z", n); 66 "%010uD%Z", n);
67 67
68 ngx_create_hashed_filename(file, path); 68 ngx_create_hashed_filename(file, path);
69 69
70 cln = ngx_pool_cleanup_add(pool, sizeof(ngx_pool_cleanup_file_t)); 70 cln = ngx_pool_cleanup_add(pool, sizeof(ngx_pool_cleanup_file_t));
71 if (cln == NULL) { 71 if (cln == NULL) {
90 } 90 }
91 91
92 err = ngx_errno; 92 err = ngx_errno;
93 93
94 if (err == NGX_EEXIST) { 94 if (err == NGX_EEXIST) {
95 n = ngx_next_temp_number(1); 95 n = (uint32_t) ngx_next_temp_number(1);
96 continue; 96 continue;
97 } 97 }
98 98
99 if ((path->level[0] == 0) 99 if ((path->level[0] == 0)
100 || (err != NGX_ENOENT 100 || (err != NGX_ENOENT