wez Fri Oct 18 08:15:04 2002 EDT Modified files: /php4/main streams.c network.c Log: Improve EOF detection. Fixes #19970. Index: php4/main/streams.c diff -u php4/main/streams.c:1.108 php4/main/streams.c:1.109 --- php4/main/streams.c:1.108 Tue Oct 15 12:45:26 2002 +++ php4/main/streams.c Fri Oct 18 08:15:04 2002 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: streams.c,v 1.108 2002/10/15 16:45:26 wez Exp $ */ +/* $Id: streams.c,v 1.109 2002/10/18 12:15:04 wez Exp $ */ #define _GNU_SOURCE #include "php.h" @@ -1280,7 +1280,7 @@ if (data->fd >= 0) { ret = read(data->fd, buf, count); - if (ret == 0 || (ret < 0 && errno != EWOULDBLOCK)) + if (ret == 0 || (ret < count && errno != EWOULDBLOCK)) stream->eof = 1; } else { @@ -1673,7 +1673,7 @@ static int stream_cookie_seeker(void *cookie, fpos_t *position, int whence) { TSRMLS_FETCH(); - + *position = php_stream_seek((php_stream *)cookie, *position, whence); if (*position == -1) @@ -1684,7 +1684,6 @@ static int stream_cookie_seeker(void *cookie, off_t position, int whence) { TSRMLS_FETCH(); - return php_stream_seek((php_stream *)cookie, position, whence); } #endif Index: php4/main/network.c diff -u php4/main/network.c:1.78 php4/main/network.c:1.79 --- php4/main/network.c:1.78 Sun Oct 13 21:27:43 2002 +++ php4/main/network.c Fri Oct 18 08:15:04 2002 @@ -16,7 +16,7 @@ | Streams work by Wez Furlong <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ */ -/* $Id: network.c,v 1.78 2002/10/14 01:27:43 wez Exp $ */ +/* $Id: network.c,v 1.79 2002/10/18 12:15:04 wez Exp $ */ /*#define DEBUG_MAIN_NETWORK 1*/ @@ -940,7 +940,7 @@ nr_bytes = recv(sock->socket, buf, count, 0); - if (nr_bytes == 0 || (nr_bytes < 0 && php_socket_errno() != EWOULDBLOCK)) { + if (nr_bytes == 0 || (nr_bytes < count && php_socket_errno() != +EWOULDBLOCK)) { stream->eof = 1; } }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php