Hi, Sorry for late response.
Maxim Dounin <mdou...@mdounin.ru> wrote: > ... > > By calling ngx_delete_file() at this point, you do this for all > errors returned by ngx_copy_file(), including cases when it wasn't > able to open a destination file for some reason. This will result > in additional confusing errors, and looks like a wrong approach. > > If you want nginx to remove a destination file, this should be > done in ngx_copy_file(). > Good point. Please find the new patch attached. -- Mindaugas
# HG changeset patch # User Mindaugas Rasiukevicius <rm...@netbsd.org> # Date 1447778549 0 # Tue Nov 17 16:42:29 2015 +0000 # Branch ngx_copy_file # Node ID a71fdd78cb5ea1d51492ec7220dc95072b803d94 # Parent 4221623f2e4622de1b5794f82111a13f43207b5a ngx_copy_file: remove the destination file on failure. diff -r 4221623f2e46 -r a71fdd78cb5e src/core/ngx_file.c --- a/src/core/ngx_file.c Tue Nov 17 17:50:57 2015 +0300 +++ b/src/core/ngx_file.c Tue Nov 17 16:42:29 2015 +0000 @@ -872,6 +872,11 @@ failed: ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno, ngx_close_file_n " \"%s\" failed", to); } + + if (rc != NGX_OK && ngx_delete_file(to) == NGX_FILE_ERROR) { + ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno, + ngx_delete_file_n " \"%s\" failed", to); + } } if (fd != NGX_INVALID_FILE) {
_______________________________________________ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel