Maxim Dounin
October 20, 2011 01:42PM
# HG changeset patch
# User Maxim Dounin <mdounin@mdounin.ru>
# Date 1319132491 -14400
# Node ID 79c66120c46633f9f68d2ebb37c1a15f03f2673a
# Parent 940ce296e112c04f5be28c70e42bed06f49a8793
Fixed another return in unix ngx_write_chain_to_file().

Previous patch missed special case for one iovec, it needs total bytes
written to be returned as well.

diff --git a/src/os/unix/ngx_files.c b/src/os/unix/ngx_files.c
--- a/src/os/unix/ngx_files.c
+++ b/src/os/unix/ngx_files.c
@@ -204,8 +204,15 @@ ngx_write_chain_to_file(ngx_file_t *file

if (vec.nelts == 1) {
iov = vec.elts;
- return ngx_write_file(file, (u_char *) iov[0].iov_base,
- iov[0].iov_len, offset);
+
+ n = ngx_write_file(file, (u_char *) iov[0].iov_base,
+ iov[0].iov_len, offset);
+
+ if (n == NGX_ERROR) {
+ return n;
+ }
+
+ return total + n;
}

if (file->sys_offset != offset) {

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] Fixed another return in unix ngx_write_chain_to_file()

Maxim Dounin 1615 October 20, 2011 01:42PM



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

Online Users

Guests: 295
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