From: Wez Furlong Date: Wed, 12 May 2004 10:46:30 +0000 (+0000) Subject: Avoid Bug #28363 by not seeking if we don't have a read buffer X-Git-Tag: php-4.3.7RC1~33 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=efb6da662d00b3532757d4d966656495f3f4e3da;p=php Avoid Bug #28363 by not seeking if we don't have a read buffer --- diff --git a/main/streams.c b/main/streams.c index 52e14ac5b2..14d0bc827e 100755 --- a/main/streams.c +++ b/main/streams.c @@ -896,7 +896,7 @@ PHPAPI size_t _php_stream_write(php_stream *stream, const char *buf, size_t coun /* 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->writepos > stream->readpos) { stream->readpos = stream->writepos = 0; stream->ops->seek(stream, stream->position, SEEK_SET, &stream->position TSRMLS_CC);