2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 05:28:00 +00:00

SOCKET vs int

This commit is contained in:
Mark Andrews 2003-01-14 23:37:06 +00:00
parent ce92f4b699
commit 2f4fbeb360

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: net.c,v 1.5 2002/10/29 04:40:25 marka Exp $ */ /* $Id: net.c,v 1.6 2003/01/14 23:37:06 marka Exp $ */
#include <config.h> #include <config.h>
@ -42,20 +42,18 @@ static isc_result_t ipv6only_result = ISC_R_NOTFOUND;
static isc_result_t static isc_result_t
try_proto(int domain) { try_proto(int domain) {
int s; SOCKET s;
isc_result_t result = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS;
char strbuf[ISC_STRERRORSIZE]; char strbuf[ISC_STRERRORSIZE];
int errval; int errval;
s = socket(domain, SOCK_STREAM, 0); s = socket(domain, SOCK_STREAM, 0);
if (s == -1) { if (s == INVALID_SOCKET) {
errval = WSAGetLastError(); errval = WSAGetLastError();
switch (errval) { switch (errval) {
case WSAEAFNOSUPPORT: case WSAEAFNOSUPPORT:
case WSAEPROTONOSUPPORT: case WSAEPROTONOSUPPORT:
#ifdef EINVAL case WSAEINVAL:
case EINVAL:
#endif
return (ISC_R_NOTFOUND); return (ISC_R_NOTFOUND);
default: default:
isc__strerror(errval, strbuf, sizeof(strbuf)); isc__strerror(errval, strbuf, sizeof(strbuf));
@ -153,7 +151,8 @@ isc_net_probeipv6(void) {
static void static void
try_ipv6only(void) { try_ipv6only(void) {
#ifdef IPV6_V6ONLY #ifdef IPV6_V6ONLY
int s, on; SOCKET s;
int on;
char strbuf[ISC_STRERRORSIZE]; char strbuf[ISC_STRERRORSIZE];
#endif #endif
isc_result_t result; isc_result_t result;
@ -170,7 +169,7 @@ try_ipv6only(void) {
#else #else
/* check for TCP sockets */ /* check for TCP sockets */
s = socket(PF_INET6, SOCK_STREAM, 0); s = socket(PF_INET6, SOCK_STREAM, 0);
if (s == -1) { if (s == INVALID_SOCKET) {
isc__strerror(errno, strbuf, sizeof(strbuf)); isc__strerror(errno, strbuf, sizeof(strbuf));
UNEXPECTED_ERROR(__FILE__, __LINE__, UNEXPECTED_ERROR(__FILE__, __LINE__,
"socket() %s: %s", "socket() %s: %s",
@ -193,7 +192,7 @@ try_ipv6only(void) {
/* check for UDP sockets */ /* check for UDP sockets */
s = socket(PF_INET6, SOCK_DGRAM, 0); s = socket(PF_INET6, SOCK_DGRAM, 0);
if (s == -1) { if (s == INVALID_SOCKET) {
isc__strerror(errno, strbuf, sizeof(strbuf)); isc__strerror(errno, strbuf, sizeof(strbuf));
UNEXPECTED_ERROR(__FILE__, __LINE__, UNEXPECTED_ERROR(__FILE__, __LINE__,
"socket() %s: %s", "socket() %s: %s",