diff options
author | Ondřej Surý <ondrej@sury.org> | 2013-04-25 12:53:02 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2013-04-25 12:53:02 +0200 |
commit | 367111123281ebfd2876d4c8cf33414b394f489a (patch) | |
tree | 9e9d69d988b632304f51746d89c1eb3e0a178257 /win32 | |
parent | 5a7c0b1f326279a6d7dba8285e81860e1f0ff8ce (diff) | |
download | php-367111123281ebfd2876d4c8cf33414b394f489a.tar.gz |
Imported Upstream version 5.5.0~beta4upstream/5.5.0_beta4
Diffstat (limited to 'win32')
-rw-r--r-- | win32/build/libs_version.txt | 3 | ||||
-rw-r--r-- | win32/sockets.c | 51 |
2 files changed, 37 insertions, 17 deletions
diff --git a/win32/build/libs_version.txt b/win32/build/libs_version.txt index 3eb9f2aa4..81c25720a 100644 --- a/win32/build/libs_version.txt +++ b/win32/build/libs_version.txt @@ -6,8 +6,7 @@ icu-49.1.2 icu-50.1.2 jpeglib-8 jpeglib-9 -libcurl-7.27.0 -libcurl-7.29.0 +libcurl-7.30.0 libiconv-1.14 libmcrypt-2.5.8 libmpir-2.5.1 diff --git a/win32/sockets.c b/win32/sockets.c index d64280870..c8fddd6e5 100644 --- a/win32/sockets.c +++ b/win32/sockets.c @@ -39,33 +39,54 @@ PHPAPI int socketpair(int domain, int type, int protocol, SOCKET sock[2]) return -1; } + sock[0] = sock[1] = redirect = INVALID_SOCKET; - sock[0] = socket(domain, type, protocol); - address.sin_addr.s_addr = INADDR_ANY; - address.sin_family = AF_INET; - address.sin_port = 0; - bind(sock[0], (struct sockaddr*)&address, sizeof(address)); + sock[0] = socket(domain, type, protocol); + if (INVALID_SOCKET == sock[0]) { + goto error; + } + + address.sin_addr.s_addr = INADDR_ANY; + address.sin_family = AF_INET; + address.sin_port = 0; + + if (bind(sock[0], (struct sockaddr*)&address, sizeof(address)) != 0) { + goto error; + } if(getsockname(sock[0], (struct sockaddr *)&address, &size) != 0) { + goto error; + } + + if (listen(sock[0], 2) != 0) { + goto error; + } + + sock[1] = socket(domain, type, protocol); + if (INVALID_SOCKET == sock[1]) { + goto error; } - listen(sock[0], 2); - sock[1] = socket(domain, type, protocol); address.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + if(connect(sock[1], (struct sockaddr*)&address, sizeof(address)) != 0) { + goto error; + } - connect(sock[1], (struct sockaddr*)&address, sizeof(address)); redirect = accept(sock[0],(struct sockaddr*)&address, &size); + if (INVALID_SOCKET == redirect) { + goto error; + } closesocket(sock[0]); sock[0] = redirect; - if(sock[0] == INVALID_SOCKET ) { - closesocket(sock[0]); - closesocket(sock[1]); - WSASetLastError(WSAECONNABORTED); - return -1; - } - return 0; + +error: + closesocket(redirect); + closesocket(sock[0]); + closesocket(sock[1]); + WSASetLastError(WSAECONNABORTED); + return -1; } |