]> git.kaiwu.me - nginx.git/commitdiff
Fixed another return in unix ngx_write_chain_to_file().
authorMaxim Dounin <mdounin@mdounin.ru>
Fri, 21 Oct 2011 11:04:46 +0000 (11:04 +0000)
committerMaxim Dounin <mdounin@mdounin.ru>
Fri, 21 Oct 2011 11:04:46 +0000 (11:04 +0000)
Previous patch missed special case for one iovec, it needs total bytes
written to be returned as well.

src/os/unix/ngx_files.c

index 4bfde44f4a2c64932119e078d460e9a7ad0e4e2d..ad26d27526ffc65622f97ab198d7a4b2583db302 100644 (file)
@@ -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) {