diff options
author | Igor Sysoev <igor@sysoev.ru> | 2003-11-17 00:49:42 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2003-11-17 00:49:42 +0300 |
commit | f2e676aa1585de170b39cf3e9d71b88db47e4b1b (patch) | |
tree | 3553b3481de51b2321b201ae34024f178af894c1 /src/http/ngx_http_cache.c | |
parent | 297c0487518d4b974a548dfd3d5d2f10c250177c (diff) |
nginx-0.0.1-2003-11-17-00:49:42 import
Diffstat (limited to 'src/http/ngx_http_cache.c')
-rw-r--r-- | src/http/ngx_http_cache.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/http/ngx_http_cache.c b/src/http/ngx_http_cache.c index 4f599ee67..b11558c90 100644 --- a/src/http/ngx_http_cache.c +++ b/src/http/ngx_http_cache.c @@ -5,8 +5,7 @@ #include <md5.h> -/* STUB */ -#if (WIN32) +#if (HAVE_OPENSSL_MD5) #define MD5Init MD5_Init #define MD5Update MD5_Update #define MD5Final MD5_Final @@ -71,14 +70,14 @@ int ngx_http_cache_open_file(ngx_http_request_t *r, ngx_http_cache_ctx_t *ctx, } if (uniq) { - if (ngx_stat_fd(ctx->file.fd, &ctx->file.info) == NGX_FILE_ERROR) { + if (ngx_fd_info(ctx->file.fd, &ctx->file.info) == NGX_FILE_ERROR) { ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, - ngx_stat_fd_n " \"%s\" failed", ctx->file.name.data); + ngx_fd_info_n " \"%s\" failed", ctx->file.name.data); return NGX_ERROR; } - if (ngx_file_uniq((&ctx->file.info)) == uniq) { + if (ngx_file_uniq(&ctx->file.info) == uniq) { if (ngx_close_file(ctx->file.fd) == NGX_FILE_ERROR) { ngx_log_error(NGX_LOG_ALERT, r->connection->log, ngx_errno, ngx_close_file_n " \"%s\" failed", @@ -140,12 +139,22 @@ int ngx_http_cache_update_file(ngx_http_request_t *r, ngx_http_cache_ctx_t *ctx, retry = 0; for ( ;; ) { - if (ngx_rename_file(temp_file, (&ctx->file.name), r->pool) == NGX_OK) { + if (ngx_rename_file(temp_file->data, ctx->file.name.data) == NGX_OK) { return NGX_OK; } err = ngx_errno; +#if (WIN32) + if (err == NGX_EEXIST) { + if (ngx_win32_rename_file(temp_file, &ctx->file.name, r->pool) + == NGX_ERROR) + { + return NGX_ERROR; + } + } +#endif + if (retry || (err != NGX_ENOENT && err != NGX_ENOTDIR)) { ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, ngx_rename_file_n "(\"%s\", \"%s\") failed", |