Mercurial > hg > nginx
comparison src/core/ngx_file.c @ 1090:01b48bcb73bf
shorten temporary names on 64-bit platforms
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 29 Jan 2007 20:28:00 +0000 |
parents | 4d203f76b757 |
children | 58f1641783ca |
comparison
equal
deleted
inserted
replaced
1089:b2e6eb425770 | 1090:01b48bcb73bf |
---|---|
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 + NGX_ATOMIC_T_LEN; |
48 | 48 |
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 |