summaryrefslogtreecommitdiff
path: root/main/streams.c
diff options
context:
space:
mode:
authorSascha Schumann <sas@php.net>2003-01-30 21:06:34 +0000
committerSascha Schumann <sas@php.net>2003-01-30 21:06:34 +0000
commit4cf174cbd44de97cc1f504a0f47865454cd6fabc (patch)
tree344b8f1e1c56c2775532f8ade45982fd72402048 /main/streams.c
parent65146ceb269d9ddbef3c828bd6ca2470cedfed8d (diff)
downloadphp-git-4cf174cbd44de97cc1f504a0f47865454cd6fabc.tar.gz
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.
Diffstat (limited to 'main/streams.c')
-rwxr-xr-xmain/streams.c6
1 files 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;
}