Skip to content

Commit

Permalink
MFH:
Browse files Browse the repository at this point in the history
- Added check for EWOULDBLOCK
- Using EWOULDBLOCK instead of EAGAIN by portability issues
(Related to #46917)
  • Loading branch information
felipensp committed Jan 7, 2009
1 parent c7ef31a commit 7c98911
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions main/php_network.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion main/streams/xp_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 7c98911

Please sign in to comment.