Call ioctlsocket() indirectly

We were calling ioctlsocket() through a macro.  However, due to type
safety issues, we have to call it indirectly through rk_SOCK_IOCTL().
This commit is contained in:
Asanka Herath
2010-06-03 00:55:44 -04:00
parent 6b0baa2a8d
commit 04a7eaa170
2 changed files with 15 additions and 1 deletions

View File

@@ -68,7 +68,8 @@ typedef SOCKET rk_socket_t;
#define rk_IS_BAD_SOCKET(s) ((s) == INVALID_SOCKET)
#define rk_IS_SOCKET_ERROR(rv) ((rv) == SOCKET_ERROR)
#define rk_SOCK_ERRNO WSAGetLastError()
#define rk_SOCK_IOCTL(s,c,a) ioctlsocket((s),(c),(a))
ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_SOCK_IOCTL(SOCKET s, long cmd, int * argp);
#define ETIMEDOUT WSAETIMEDOUT
#define EWOULDBLOCK WSAEWOULDBLOCK

View File

@@ -316,6 +316,19 @@ socket_to_fd(rk_socket_t sock, int flags)
#endif
}
#ifdef HAVE_WINSOCK
ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
rk_SOCK_IOCTL(SOCKET s, long cmd, int * argp) {
u_long ul = (argp)? *argp : 0;
int rv;
rv = ioctlsocket(s, cmd, &ul);
if (argp)
*argp = (int) ul;
return rv;
}
#endif
#ifndef HEIMDAL_SMALLER
#undef socket