Klaus Demo nginx / 27dd6a6
use malloc() in ngx_win32_rename_file, set crit level instead of error Igor Sysoev 14 years ago
4 changed file(s) with 10 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
294294 #if (NGX_WIN32)
295295
296296 if (err == NGX_EEXIST) {
297 if (ngx_win32_rename_file(temp, &path, r->pool) != NGX_ERROR) {
297 if (ngx_win32_rename_file(temp, &path, r->connection->log) == NGX_OK) {
298298
299299 if (ngx_rename_file(temp->data, path.data) != NGX_FILE_ERROR) {
300300 goto ok;
22232223 #if (NGX_WIN32)
22242224
22252225 if (err == NGX_EEXIST) {
2226 if (ngx_win32_rename_file(temp, &path, r->pool) != NGX_ERROR) {
2226 if (ngx_win32_rename_file(temp, &path, r->connection->log) == NGX_OK) {
22272227
22282228 if (ngx_rename_file(temp->data, path.data) != NGX_FILE_ERROR) {
22292229 return;
200200
201201
202202 ngx_int_t
203 ngx_win32_rename_file(ngx_str_t *from, ngx_str_t *to, ngx_pool_t *pool)
203 ngx_win32_rename_file(ngx_str_t *from, ngx_str_t *to, ngx_log_t *log)
204204 {
205205 u_char *name;
206206 ngx_int_t rc;
207207 ngx_uint_t collision;
208208 ngx_atomic_uint_t num;
209209
210 name = ngx_palloc(pool, to->len + 1 + 10 + 1 + sizeof("DELETE"));
210 name = ngx_alloc(to->len + 1 + 10 + 1 + sizeof("DELETE"), log);
211211 if (name == NULL) {
212212 return NGX_ERROR;
213213 }
229229
230230 collision = 1;
231231
232 ngx_log_error(NGX_LOG_ERR, pool->log, ngx_errno, "MoveFile() failed");
232 ngx_log_error(NGX_LOG_CRIT, log, ngx_errno, "MoveFile() failed");
233233 }
234234
235235 if (MoveFile((const char *) from->data, (const char *) to->data) == 0) {
240240 }
241241
242242 if (DeleteFile((const char *) name) == 0) {
243 ngx_log_error(NGX_LOG_ERR, pool->log, ngx_errno, "DeleteFile() failed");
243 ngx_log_error(NGX_LOG_CRIT, log, ngx_errno, "DeleteFile() failed");
244244 }
245245
246246 if (rc == NGX_ERROR) {
247 ngx_log_error(NGX_LOG_ERR, pool->log, ngx_errno, "MoveFile() failed");
247 ngx_log_error(NGX_LOG_CRIT, log, ngx_errno, "MoveFile() failed");
248248 }
249249
250250 /* mutex_unlock() */
251
252 ngx_free(name);
251253
252254 return rc;
253255 }
8585
8686 #define ngx_rename_file(o, n) MoveFile((const char *) o, (const char *) n)
8787 #define ngx_rename_file_n "MoveFile()"
88 ngx_int_t ngx_win32_rename_file(ngx_str_t *from, ngx_str_t *to,
89 ngx_pool_t *pool);
88 ngx_int_t ngx_win32_rename_file(ngx_str_t *from, ngx_str_t *to, ngx_log_t *log);
9089
9190
9291