From 9ef4b63328f534a647b367be1bce3b5a159e7c32 Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Tue, 17 Nov 2015 19:01:41 +0300 Subject: [PATCH] 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. --- src/os/unix/ngx_files.c | 1 + 1 file changed, 1 insertion(+) 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;