summaryrefslogtreecommitdiff
path: root/main/streams/streams.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2005-04-29 19:01:33 +0000
committerIlia Alshanetsky <iliaa@php.net>2005-04-29 19:01:33 +0000
commitedd486067482514f8e8f1998612a1c251ac34671 (patch)
treeb38f595b2752070676866cf2e6811b4e30e71b37 /main/streams/streams.c
parent217e89b1249f629695bf19772dfdf38bd16bf654 (diff)
downloadphp-git-edd486067482514f8e8f1998612a1c251ac34671.tar.gz
Attempt to eliminate seek() prior to every write.
Diffstat (limited to 'main/streams/streams.c')
-rwxr-xr-xmain/streams/streams.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/main/streams/streams.c b/main/streams/streams.c
index 68ce4f0a76..3729eaf74e 100755
--- a/main/streams/streams.c
+++ b/main/streams/streams.c
@@ -892,7 +892,7 @@ static size_t _php_stream_write_buffer(php_stream *stream, const char *buf, size
/* if we have a seekable stream we need to ensure that data is written at the
* current stream->position. This means invalidating the read buffer and then
* performing a low-level seek */
- if (stream->ops->seek && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0) {
+ if (stream->ops->seek && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0 && stream->readpos != stream->writepos) {
stream->readpos = stream->writepos = 0;
stream->ops->seek(stream, stream->position, SEEK_SET, &stream->position TSRMLS_CC);