From 4cf174cbd44de97cc1f504a0f47865454cd6fabc Mon Sep 17 00:00:00 2001 From: Sascha Schumann Date: Thu, 30 Jan 2003 21:06:34 +0000 Subject: [PATCH] Fix sticky EOF problem Sometimes streams signal a temporary EOF, because all current data has been consumed. But that does not preclude the possibility that more data will become available later. Thus we must not treat eof in the read path as final. Now, "tail -f" like scripts work again. --- main/streams.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main/streams.c b/main/streams.c index 4792fc3fb0..a1fa323df4 100755 --- a/main/streams.c +++ b/main/streams.c @@ -521,8 +521,7 @@ static void php_stream_fill_read_buffer(php_stream *stream, size_t size TSRMLS_D if (stream->writepos - stream->readpos < (off_t)size) { size_t justread = 0; - if (stream->eof) - return; + /* ignore eof here; the underlying state might have changed */ /* no; so lets fetch more data */ @@ -581,7 +580,8 @@ PHPAPI size_t _php_stream_read(php_stream *stream, char *buf, size_t size TSRMLS didread += toread; } - if (size == 0 || stream->eof) { + /* ignore eof here; the underlying state might have changed */ + if (size == 0) { break; } -- 2.50.1