comparison src/os/unix/ngx_files.c @ 4221:3203ddb78279

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.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 21 Oct 2011 11:04:46 +0000
parents 4be8dd8dd547
children 11e47bf300db
comparison
equal deleted inserted replaced
4220:4be8dd8dd547 4221:3203ddb78279
202 202
203 /* use pwrite() if there is the only iovec buffer */ 203 /* use pwrite() if there is the only iovec buffer */
204 204
205 if (vec.nelts == 1) { 205 if (vec.nelts == 1) {
206 iov = vec.elts; 206 iov = vec.elts;
207 return ngx_write_file(file, (u_char *) iov[0].iov_base, 207
208 iov[0].iov_len, offset); 208 n = ngx_write_file(file, (u_char *) iov[0].iov_base,
209 iov[0].iov_len, offset);
210
211 if (n == NGX_ERROR) {
212 return n;
213 }
214
215 return total + n;
209 } 216 }
210 217
211 if (file->sys_offset != offset) { 218 if (file->sys_offset != offset) {
212 if (lseek(file->fd, offset, SEEK_SET) == -1) { 219 if (lseek(file->fd, offset, SEEK_SET) == -1) {
213 ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno, 220 ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno,