Welcome! Log In Create A New Profile

Advanced

[nginx] Dav: fixed ngx_copy_file() to truncate destination file.

Maxim Dounin
August 01, 2018 12:24AM
details: http://hg.nginx.org/nginx/rev/3c357206a3b8
branches:
changeset: 7328:3c357206a3b8
user: Maxim Dounin <mdounin@mdounin.ru>
date: Wed Aug 01 02:11:58 2018 +0300
description:
Dav: fixed ngx_copy_file() to truncate destination file.

Previously, ngx_open_file(NGX_FILE_CREATE_OR_OPEN) was used, resulting
in destination file being partially rewritten if exists. Notably,
this affected WebDAV COPY command (ticket #1576).

diffstat:

src/core/ngx_file.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diffs (13 lines):

diff --git a/src/core/ngx_file.c b/src/core/ngx_file.c
--- a/src/core/ngx_file.c
+++ b/src/core/ngx_file.c
@@ -839,8 +839,7 @@ ngx_copy_file(u_char *from, u_char *to,
goto failed;
}

- nfd = ngx_open_file(to, NGX_FILE_WRONLY, NGX_FILE_CREATE_OR_OPEN,
- cf->access);
+ nfd = ngx_open_file(to, NGX_FILE_WRONLY, NGX_FILE_TRUNCATE, cf->access);

if (nfd == NGX_INVALID_FILE) {
ngx_log_error(NGX_LOG_CRIT, cf->log, ngx_errno,
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Dav: fixed ngx_copy_file() to truncate destination file.

Maxim Dounin 286 August 01, 2018 12:24AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 321
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready