comparison src/os/win32/ngx_files.c @ 499:64d9afb209da release-0.1.24

nginx-0.1.24-RELEASE import *) Feature: the ngx_http_ssi_filter_module supports the QUERY_STRING and DOCUMENT_URI variables. *) Bugfix: the ngx_http_autoindex_module may some times return the 404 response for existent directory, if this directory was used in "alias" directive. *) Bugfix: the ngx_http_ssi_filter_module ran incorrectly for large responses. *) Bugfix: the lack of the "Referer" header line was always accounted as valid referrer.
author Igor Sysoev <igor@sysoev.ru>
date Fri, 04 Mar 2005 14:06:57 +0000
parents bbd6b0b4a2b1
children d4ea69372b94
comparison
equal deleted inserted replaced
498:58fcf570b0cb 499:64d9afb209da
172 172
173 173
174 ngx_int_t ngx_win32_rename_file(ngx_str_t *from, ngx_str_t *to, 174 ngx_int_t ngx_win32_rename_file(ngx_str_t *from, ngx_str_t *to,
175 ngx_pool_t *pool) 175 ngx_pool_t *pool)
176 { 176 {
177 int rc, collision; 177 u_char *name;
178 u_int num; 178 ngx_int_t rc;
179 u_char *name; 179 ngx_uint_t collision;
180 ngx_atomic_uint_t num;
180 181
181 if (!(name = ngx_palloc(pool, to->len + 1 + 10 + 1 + sizeof("DELETE")))) { 182 if (!(name = ngx_palloc(pool, to->len + 1 + 10 + 1 + sizeof("DELETE")))) {
182 return NGX_ERROR; 183 return NGX_ERROR;
183 } 184 }
184 185
186 187
187 collision = 0; 188 collision = 0;
188 189
189 /* mutex_lock() (per cache or single ?) */ 190 /* mutex_lock() (per cache or single ?) */
190 191
191 do { 192 for ( ;; ) {
192 num = ngx_next_temp_number(collision); 193 num = ngx_next_temp_number(collision);
193 194
194 ngx_sprintf(name + to->len, ".%010u.DELETE", num); 195 ngx_sprintf(name + to->len, ".%0muA.DELETE", num);
195 196
196 if (MoveFile((const char *) to->data, (const char *) name) == 0) { 197 if (MoveFile((const char *) to->data, (const char *) name) != 0) {
197 collision = 1; 198 break;
198 ngx_log_error(NGX_LOG_ERR, pool->log, ngx_errno, 199 }
199 "MoveFile() failed"); 200
200 } 201 collision = 1;
201 202
202 } while (collision); 203 ngx_log_error(NGX_LOG_ERR, pool->log, ngx_errno, "MoveFile() failed");
204 }
203 205
204 if (MoveFile((const char *) from->data, (const char *) to->data) == 0) { 206 if (MoveFile((const char *) from->data, (const char *) to->data) == 0) {
205 rc = NGX_ERROR; 207 rc = NGX_ERROR;
206 208
207 } else { 209 } else {