From: Sascha Schumann Date: Thu, 30 Jan 2003 21:06:34 +0000 (+0000) Subject: Fix sticky EOF problem X-Git-Tag: RELEASE_0_5~1359 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4cf174cbd44de97cc1f504a0f47865454cd6fabc;p=php 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. --- 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; }