From: Wez Furlong Date: Thu, 13 Feb 2003 21:08:04 +0000 (+0000) Subject: MFB: Fix for bug #22199 X-Git-Tag: RELEASE_0_5~1030 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f98f27ffa97d6e282a0ab60ab83082e90e3f295a;p=php MFB: Fix for bug #22199 --- diff --git a/main/streams.c b/main/streams.c index 097b815564..2a97033e4a 100755 --- a/main/streams.c +++ b/main/streams.c @@ -869,14 +869,17 @@ PHPAPI size_t _php_stream_write(php_stream *stream, const char *buf, size_t coun justwrote = stream->ops->write(stream, buf, towrite TSRMLS_CC); } if (justwrote > 0) { - stream->position += justwrote; buf += justwrote; count -= justwrote; didwrite += justwrote; - /* FIXME: invalidate the whole readbuffer */ - stream->writepos = 0; - stream->readpos = 0; + /* Only screw with the buffer if we can seek, otherwise we lose data + * buffered from fifos and sockets */ + if (stream->ops->seek && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0) { + stream->position += justwrote; + stream->writepos = 0; + stream->readpos = 0; + } } else { break; }