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.
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 */
didread += toread;
}
- if (size == 0 || stream->eof) {
+ /* ignore eof here; the underlying state might have changed */
+ if (size == 0) {
break;
}