From: Wez Furlong Date: Wed, 8 Oct 2003 10:55:51 +0000 (+0000) Subject: Set the EOF indicator after each read attempt. X-Git-Tag: RELEASE_1_3b3~89 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=590b3ccc79496e746c7aab8a62c2ccbb4ba8ceb2;p=php Set the EOF indicator after each read attempt. This prevents it getting stuck in the on position. --- 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);