comparison src/core/ngx_file.c @ 3032:524ba56ba9f7

fix copy destination name length, introduced in r3025
author Igor Sysoev <igor@sysoev.ru>
date Thu, 20 Aug 2009 13:37:26 +0000
parents 3e1b653fd22f
children db3e5c4c7413
comparison
equal deleted inserted replaced
3031:98a8336c5b7c 3032:524ba56ba9f7
603 cf.buf_size = 0; 603 cf.buf_size = 0;
604 cf.access = ext->access; 604 cf.access = ext->access;
605 cf.time = ext->time; 605 cf.time = ext->time;
606 cf.log = ext->log; 606 cf.log = ext->log;
607 607
608 name = ngx_alloc(to->len + 1 + 10, ext->log); 608 name = ngx_alloc(to->len + 1 + 10 + 1, ext->log);
609 if (name == NULL) { 609 if (name == NULL) {
610 return NGX_ERROR; 610 return NGX_ERROR;
611 } 611 }
612 612
613 (void) ngx_sprintf(name, "%*s.%010uD%Z", to->len - 1, to->data, 613 (void) ngx_sprintf(name, "%*s.%010uD%Z", to->len, to->data,
614 (uint32_t) ngx_next_temp_number(0)); 614 (uint32_t) ngx_next_temp_number(0));
615 615
616 if (ngx_copy_file(src->data, name, &cf) == NGX_OK) { 616 if (ngx_copy_file(src->data, name, &cf) == NGX_OK) {
617 617
618 if (ngx_rename_file(name, to->data) == NGX_FILE_ERROR) { 618 if (ngx_rename_file(name, to->data) == NGX_FILE_ERROR) {