summaryrefslogtreecommitdiff
path: root/main/streams.c
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2002-10-21 22:54:37 +0000
committerWez Furlong <wez@php.net>2002-10-21 22:54:37 +0000
commitdabf1053cdbd1bf8cd9020d16b41eb6b7ca2013f (patch)
tree84cb33061e3e0e32ddec7c432b5d4b64c5c85233 /main/streams.c
parent102c94550126b9e004d22620300033f0fe9a2006 (diff)
downloadphp-git-dabf1053cdbd1bf8cd9020d16b41eb6b7ca2013f.tar.gz
Refine stream_select() to work with streams that have data in their read
buffers. When selecting for read, the streams are examined; if any of them have pending read data, no actual select(2) call is performed; instead the streams with buffered data are returned; just like a regular select call. Prevent erroneous warning in stream_select when obtaining the fd.
Diffstat (limited to 'main/streams.c')
-rwxr-xr-xmain/streams.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/main/streams.c b/main/streams.c
index cab4e2f001..e288445b3b 100755
--- a/main/streams.c
+++ b/main/streams.c
@@ -1820,7 +1820,9 @@ PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show
exit_success:
- if ((stream->writepos - stream->readpos) > 0 && stream->fclose_stdiocast != PHP_STREAM_FCLOSE_FOPENCOOKIE) {
+ if ((stream->writepos - stream->readpos) > 0 &&
+ stream->fclose_stdiocast != PHP_STREAM_FCLOSE_FOPENCOOKIE &&
+ (flags & PHP_STREAM_CAST_INTERNAL) == 0) {
/* the data we have buffered will be lost to the third party library that
* will be accessing the stream. Emit a warning so that the end-user will
* know that they should try something else */