[nginx] Adjusted file->sys_offset after the write() syscall.
Valentin Bartenev
vbart at nginx.com
Tue Nov 17 16:02:16 UTC 2015
details: http://hg.nginx.org/nginx/rev/8f6d753c1953
branches:
changeset: 6298:8f6d753c1953
user: Valentin Bartenev <vbart at nginx.com>
date: Tue Nov 17 19:01:41 2015 +0300
description:
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:
src/os/unix/ngx_files.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diffs (11 lines):
diff -r 92482faf5d8a -r 8f6d753c1953 src/os/unix/ngx_files.c
--- a/src/os/unix/ngx_files.c Tue Nov 17 19:01:41 2015 +0300
+++ b/src/os/unix/ngx_files.c Tue Nov 17 19:01:41 2015 +0300
@@ -226,6 +226,7 @@ ngx_write_file(ngx_file_t *file, u_char
return NGX_ERROR;
}
+ file->sys_offset += n;
file->offset += n;
written += n;
More information about the nginx-devel
mailing list