Mercurial > hg > nginx-quic
diff 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 |
line wrap: on
line diff
--- a/src/os/win32/ngx_files.c +++ b/src/os/win32/ngx_files.c @@ -174,9 +174,10 @@ ssize_t ngx_write_chain_to_file(ngx_file ngx_int_t ngx_win32_rename_file(ngx_str_t *from, ngx_str_t *to, ngx_pool_t *pool) { - int rc, collision; - u_int num; - u_char *name; + u_char *name; + ngx_int_t rc; + ngx_uint_t collision; + ngx_atomic_uint_t num; if (!(name = ngx_palloc(pool, to->len + 1 + 10 + 1 + sizeof("DELETE")))) { return NGX_ERROR; @@ -188,18 +189,19 @@ ngx_int_t ngx_win32_rename_file(ngx_str_ /* mutex_lock() (per cache or single ?) */ - do { + for ( ;; ) { num = ngx_next_temp_number(collision); - ngx_sprintf(name + to->len, ".%010u.DELETE", num); + ngx_sprintf(name + to->len, ".%0muA.DELETE", num); - if (MoveFile((const char *) to->data, (const char *) name) == 0) { - collision = 1; - ngx_log_error(NGX_LOG_ERR, pool->log, ngx_errno, - "MoveFile() failed"); + if (MoveFile((const char *) to->data, (const char *) name) != 0) { + break; } - } while (collision); + collision = 1; + + ngx_log_error(NGX_LOG_ERR, pool->log, ngx_errno, "MoveFile() failed"); + } if (MoveFile((const char *) from->data, (const char *) to->data) == 0) { rc = NGX_ERROR;