diff options
author | Wez Furlong <wez@php.net> | 2003-10-08 10:55:51 +0000 |
---|---|---|
committer | Wez Furlong <wez@php.net> | 2003-10-08 10:55:51 +0000 |
commit | 590b3ccc79496e746c7aab8a62c2ccbb4ba8ceb2 (patch) | |
tree | d5bace4145dfd7f5cad2514b5f63206285fcc096 | |
parent | e85a4cdbd20384d707c4e2afdfe48f1ca0896b59 (diff) | |
download | php-git-590b3ccc79496e746c7aab8a62c2ccbb4ba8ceb2.tar.gz |
Set the EOF indicator after each read attempt.
This prevents it getting stuck in the on position.
-rw-r--r-- | main/streams/plain_wrapper.c | 6 | ||||
-rw-r--r-- | main/streams/xp_socket.c | 4 |
2 files changed, 3 insertions, 7 deletions
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index a7ac4fa5e7..1f060ec666 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -370,8 +370,7 @@ static size_t php_stdiop_read(php_stream *stream, char *buf, size_t count TSRMLS if (data->fd >= 0) { ret = read(data->fd, buf, count); - if (ret == 0 || (ret == -1 && errno != EWOULDBLOCK)) - stream->eof = 1; + stream->eof = (ret == 0 || (ret == -1 && errno != EWOULDBLOCK)); } else { #if HAVE_FLUSHIO @@ -382,8 +381,7 @@ static size_t php_stdiop_read(php_stream *stream, char *buf, size_t count TSRMLS ret = fread(buf, 1, count, data->file); - if (feof(data->file)) - stream->eof = 1; + stream->eof = feof(data->file); } return ret; } diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c index 1663a85ffa..193958fa6e 100644 --- a/main/streams/xp_socket.c +++ b/main/streams/xp_socket.c @@ -124,9 +124,7 @@ static size_t php_sockop_read(php_stream *stream, char *buf, size_t count TSRMLS nr_bytes = recv(sock->socket, buf, count, 0); - if (nr_bytes == 0 || (nr_bytes == -1 && php_socket_errno() != EWOULDBLOCK)) { - stream->eof = 1; - } + stream->eof = (nr_bytes == 0 || (nr_bytes == -1 && php_socket_errno() != EWOULDBLOCK)); if (nr_bytes > 0) { php_stream_notify_progress_increment(stream->context, nr_bytes, 0); |