cvs: php4 /main streams.c
| From: | Sascha Schumann | Date: | Thu, 30 Jan 2003 21:06:35 +0000 |
| Subject: | cvs: php4 /main streams.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-18306@lists.php.net to get a copy of this message | ||
sas Thu Jan 30 16:06:35 2003 EDT
Modified files:
/php4/main streams.c
Log:
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.
Index: php4/main/streams.c
diff -u php4/main/streams.c:1.142 php4/main/streams.c:1.143
--- php4/main/streams.c:1.142 Mon Jan 6 18:27:03 2003
+++ php4/main/streams.c Thu Jan 30 16:06:34 2003
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: streams.c,v 1.142 2003/01/06 23:27:03 wez Exp $ */
+/* $Id: streams.c,v 1.143 2003/01/30 21:06:34 sas Exp $ */
#define _GNU_SOURCE
#include "php.h"
@@ -521,8 +521,7 @@
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 @@
didread += toread;
}
- if (size == 0 || stream->eof) {
+ /* ignore eof here; the underlying state might have changed */
+ if (size == 0) {
break;
}