summaryrefslogtreecommitdiff
path: root/file_io/unix
diff options
context:
space:
mode:
Diffstat (limited to 'file_io/unix')
-rw-r--r--file_io/unix/readwrite.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/file_io/unix/readwrite.c b/file_io/unix/readwrite.c
index 3511846d9..412d7c8ba 100644
--- a/file_io/unix/readwrite.c
+++ b/file_io/unix/readwrite.c
@@ -252,6 +252,15 @@ APR_DECLARE(apr_status_t) apr_file_writev(apr_file_t *thefile, const struct iove
if (rv != APR_SUCCESS) {
return rv;
}
+ if (thefile->direction == 0) {
+ /* Position file pointer for writing at the offset we are
+ * logically reading from
+ */
+ apr_int64_t offset = thefile->filePtr - thefile->dataRead + thefile->bufpos;
+ if (offset != thefile->filePtr)
+ lseek(thefile->filedes, offset, SEEK_SET);
+ thefile->bufpos = thefile->dataRead = 0;
+ }
}
#ifdef HAVE_WRITEV