aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix/ngx_files.c
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2015-11-17 19:01:41 +0300
committerValentin Bartenev <vbart@nginx.com>2015-11-17 19:01:41 +0300
commit9ef4b63328f534a647b367be1bce3b5a159e7c32 (patch)
tree36e0e561795724da57a345ee3e0e597e8ac6ea91 /src/os/unix/ngx_files.c
parent3aef20d257b5afb385da7fa85dfeed89cf9314ea (diff)
downloadnginx-9ef4b63328f534a647b367be1bce3b5a159e7c32.tar.gz
nginx-9ef4b63328f534a647b367be1bce3b5a159e7c32.zip
Adjusted file->sys_offset after the write() syscall.
This fixes suboptimal behavior caused by surplus lseek() for sequential writes on systems without pwrite(). A consecutive read after write might result in an error on systems without pread() and pwrite(). Fortunately, at the moment there are no widely used systems without these syscalls.
Diffstat (limited to 'src/os/unix/ngx_files.c')
-rw-r--r--src/os/unix/ngx_files.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/os/unix/ngx_files.c b/src/os/unix/ngx_files.c
index 417b598f7..36b6b67ca 100644
--- a/src/os/unix/ngx_files.c
+++ b/src/os/unix/ngx_files.c
@@ -226,6 +226,7 @@ ngx_write_file(ngx_file_t *file, u_char *buf, size_t size, off_t offset)
return NGX_ERROR;
}
+ file->sys_offset += n;
file->offset += n;
written += n;