diff options
Diffstat (limited to 'file_io/unix/seek.c')
-rw-r--r-- | file_io/unix/seek.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/file_io/unix/seek.c b/file_io/unix/seek.c index 3f5aa00e95677..2e973377bf84d 100644 --- a/file_io/unix/seek.c +++ b/file_io/unix/seek.c @@ -117,6 +117,13 @@ apr_status_t apr_file_trunc(apr_file_t *fp, apr_off_t offset) /* Reset buffer positions for write mode */ fp->bufpos = fp->direction = fp->dataRead = 0; } + else if (fp->direction == 0) { + /* Discard the read buffer, as we are about to reposition + * ourselves to the end of file. + */ + fp->bufpos = 0; + fp->dataRead = 0; + } file_unlock(fp); if (rc) { return rc; |