diff options
author | Maxim Dounin <mdounin@mdounin.ru> | 2011-10-21 15:04:46 +0400 |
---|---|---|
committer | Maxim Dounin <mdounin@mdounin.ru> | 2011-10-21 15:04:46 +0400 |
commit | ce61ff9c453702d45998e1ae1394dc44e9c5eb6a (patch) | |
tree | 3ffff37ec457af1716b33ebf460e584d89fc18aa /src/os | |
parent | aecb2eda1368aa7e3b58738f2577474d98bf58ca (diff) |
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.
Diffstat (limited to 'src/os')
-rw-r--r-- | src/os/unix/ngx_files.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/os/unix/ngx_files.c b/src/os/unix/ngx_files.c index 4bfde44f4..ad26d2752 100644 --- 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, ngx_chain_t *cl, off_t offset, 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) { |