summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2013-05-16 19:23:31 +0200
committerAnatol Belski <ab@php.net>2013-05-16 19:23:31 +0200
commit8dec06ea2afbe577191b13152e8f4622a80aeb0c (patch)
tree7c2ed4b55409a939bc03603b72466c43c7752cf6
parentd82704b6779cf54e9c8bd16ecc78c612892b4c9d (diff)
downloadphp-git-8dec06ea2afbe577191b13152e8f4622a80aeb0c.tar.gz
Fixed error handling for ext/sockets under win
WSAGetLastError() must be the very next call after a socket function had an invalid return. Any function call inbetween will clear the error information.
-rw-r--r--ext/sockets/sockets.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
index 06bd0ec6b4..b3bcbf2600 100644
--- a/ext/sockets/sockets.c
+++ b/ext/sockets/sockets.c
@@ -1822,8 +1822,8 @@ PHP_FUNCTION(socket_recvfrom)
retval = recvfrom(php_sock->bsd_socket, recv_buf, arg3, arg4, (struct sockaddr *)&s_un, (socklen_t *)&slen);
if (retval < 0) {
- efree(recv_buf);
PHP_SOCKET_ERROR(php_sock, "unable to recvfrom", errno);
+ efree(recv_buf);
RETURN_FALSE;
}
@@ -1847,8 +1847,8 @@ PHP_FUNCTION(socket_recvfrom)
retval = recvfrom(php_sock->bsd_socket, recv_buf, arg3, arg4, (struct sockaddr *)&sin, (socklen_t *)&slen);
if (retval < 0) {
- efree(recv_buf);
PHP_SOCKET_ERROR(php_sock, "unable to recvfrom", errno);
+ efree(recv_buf);
RETURN_FALSE;
}
@@ -1876,8 +1876,8 @@ PHP_FUNCTION(socket_recvfrom)
retval = recvfrom(php_sock->bsd_socket, recv_buf, arg3, arg4, (struct sockaddr *)&sin6, (socklen_t *)&slen);
if (retval < 0) {
- efree(recv_buf);
PHP_SOCKET_ERROR(php_sock, "unable to recvfrom", errno);
+ efree(recv_buf);
RETURN_FALSE;
}