Disabled reading from stream (calls to read()) after EOF

This commit is contained in:
Dmitry Stogov 2006-11-10 13:10:16 +00:00
parent f05ed6390c
commit f22ae56bc9
2 changed files with 5 additions and 0 deletions

2
NEWS
View File

@ -9,6 +9,8 @@ PHP NEWS
In case of modification of corresponding registry-tree PHP will reload
it automatic
. start timiout thread only if necessary
- Streams optimization (Dmitry)
. disabled calls to read() after EOF
- VCWD_REALPATH() is improved to use realpath cache without VIRTUAL_DIR.
(Dmitry)
- ext/bcmath intialization code is moved from request startup to module

View File

@ -312,6 +312,9 @@ static size_t php_stdiop_read(php_stream *stream, char *buf, size_t count TSRMLS
assert(data != NULL);
if (data->fd >= 0) {
if (stream->eof && !data->is_pipe) {
return 0;
}
ret = read(data->fd, buf, count);
stream->eof = (ret == 0 || (ret == (size_t)-1 && errno != EWOULDBLOCK));