- Added check for EWOULDBLOCK
- Using EWOULDBLOCK instead of EAGAIN by portability issues
(Related to #46917)
This commit is contained in:
Felipe Pena 2009-01-07 20:21:46 +00:00
parent c7ef31aefb
commit 7c989115c2
2 changed files with 5 additions and 1 deletions

View File

@ -40,6 +40,10 @@
# define ftruncate(a, b) chsize(a, b)
#endif /* defined(PHP_WIN32) */
#ifndef EWOULDBLOCK
# define EWOULDBLOCK EAGAIN
#endif
#ifdef PHP_WIN32
#define php_socket_errno() WSAGetLastError()
#else

View File

@ -281,7 +281,7 @@ static int php_sockop_set_option(php_stream *stream, int option, int value, void
if (sock->socket == -1) {
alive = 0;
} else if (php_pollfd_for(sock->socket, PHP_POLLREADABLE|POLLPRI, &tv) > 0) {
if (0 == recv(sock->socket, &buf, sizeof(buf), MSG_PEEK) && php_socket_errno() != EAGAIN) {
if (0 == recv(sock->socket, &buf, sizeof(buf), MSG_PEEK) && php_socket_errno() != EWOULDBLOCK) {
alive = 0;
}
}