diff options
author | Wez Furlong <wez@php.net> | 2003-02-13 21:08:04 +0000 |
---|---|---|
committer | Wez Furlong <wez@php.net> | 2003-02-13 21:08:04 +0000 |
commit | f98f27ffa97d6e282a0ab60ab83082e90e3f295a (patch) | |
tree | ae2456b8f2d72dc050dbea5a1ce355f644553ae8 | |
parent | d1d0d0b71aadbe381070ea9b383002c2a51547bb (diff) | |
download | php-git-f98f27ffa97d6e282a0ab60ab83082e90e3f295a.tar.gz |
MFB: Fix for bug #22199
-rwxr-xr-x | main/streams.c | 11 |
1 files changed, 7 insertions, 4 deletions
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; } |