Mercurial > hg > nginx
comparison src/http/ngx_http_cache.c @ 186:c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sun, 16 Nov 2003 21:49:42 +0000 |
parents | d5f50cefc322 |
children | c966c09be66b |
comparison
equal
deleted
inserted
replaced
185:d5f50cefc322 | 186:c1f3a3c7c5db |
---|---|
3 #include <ngx_core.h> | 3 #include <ngx_core.h> |
4 #include <ngx_http.h> | 4 #include <ngx_http.h> |
5 | 5 |
6 #include <md5.h> | 6 #include <md5.h> |
7 | 7 |
8 /* STUB */ | 8 #if (HAVE_OPENSSL_MD5) |
9 #if (WIN32) | |
10 #define MD5Init MD5_Init | 9 #define MD5Init MD5_Init |
11 #define MD5Update MD5_Update | 10 #define MD5Update MD5_Update |
12 #define MD5Final MD5_Final | 11 #define MD5Final MD5_Final |
13 #endif | 12 #endif |
14 | 13 |
69 ngx_open_file_n " \"%s\" failed", ctx->file.name.data); | 68 ngx_open_file_n " \"%s\" failed", ctx->file.name.data); |
70 return NGX_ERROR; | 69 return NGX_ERROR; |
71 } | 70 } |
72 | 71 |
73 if (uniq) { | 72 if (uniq) { |
74 if (ngx_stat_fd(ctx->file.fd, &ctx->file.info) == NGX_FILE_ERROR) { | 73 if (ngx_fd_info(ctx->file.fd, &ctx->file.info) == NGX_FILE_ERROR) { |
75 ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, | 74 ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, |
76 ngx_stat_fd_n " \"%s\" failed", ctx->file.name.data); | 75 ngx_fd_info_n " \"%s\" failed", ctx->file.name.data); |
77 | 76 |
78 return NGX_ERROR; | 77 return NGX_ERROR; |
79 } | 78 } |
80 | 79 |
81 if (ngx_file_uniq((&ctx->file.info)) == uniq) { | 80 if (ngx_file_uniq(&ctx->file.info) == uniq) { |
82 if (ngx_close_file(ctx->file.fd) == NGX_FILE_ERROR) { | 81 if (ngx_close_file(ctx->file.fd) == NGX_FILE_ERROR) { |
83 ngx_log_error(NGX_LOG_ALERT, r->connection->log, ngx_errno, | 82 ngx_log_error(NGX_LOG_ALERT, r->connection->log, ngx_errno, |
84 ngx_close_file_n " \"%s\" failed", | 83 ngx_close_file_n " \"%s\" failed", |
85 ctx->file.name.data); | 84 ctx->file.name.data); |
86 } | 85 } |
138 ngx_err_t err; | 137 ngx_err_t err; |
139 | 138 |
140 retry = 0; | 139 retry = 0; |
141 | 140 |
142 for ( ;; ) { | 141 for ( ;; ) { |
143 if (ngx_rename_file(temp_file, (&ctx->file.name), r->pool) == NGX_OK) { | 142 if (ngx_rename_file(temp_file->data, ctx->file.name.data) == NGX_OK) { |
144 return NGX_OK; | 143 return NGX_OK; |
145 } | 144 } |
146 | 145 |
147 err = ngx_errno; | 146 err = ngx_errno; |
147 | |
148 #if (WIN32) | |
149 if (err == NGX_EEXIST) { | |
150 if (ngx_win32_rename_file(temp_file, &ctx->file.name, r->pool) | |
151 == NGX_ERROR) | |
152 { | |
153 return NGX_ERROR; | |
154 } | |
155 } | |
156 #endif | |
148 | 157 |
149 if (retry || (err != NGX_ENOENT && err != NGX_ENOTDIR)) { | 158 if (retry || (err != NGX_ENOENT && err != NGX_ENOTDIR)) { |
150 ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, | 159 ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, |
151 ngx_rename_file_n "(\"%s\", \"%s\") failed", | 160 ngx_rename_file_n "(\"%s\", \"%s\") failed", |
152 temp_file->data, ctx->file.name.data); | 161 temp_file->data, ctx->file.name.data); |