src/windows/native/java/net/net_util_md.c

Print this page

        

*** 387,398 **** */ JNIEXPORT int JNICALL NET_SetSockOpt(int s, int level, int optname, const void *optval, int optlen) { ! int rv; ! int parg; int plen = sizeof(parg); if (level == IPPROTO_IP && optname == IP_TOS) { int *tos = (int *)optval; *tos &= (IPTOS_TOS_MASK | IPTOS_PREC_MASK); --- 387,398 ---- */ JNIEXPORT int JNICALL NET_SetSockOpt(int s, int level, int optname, const void *optval, int optlen) { ! int rv = 0; ! int parg = 0; int plen = sizeof(parg); if (level == IPPROTO_IP && optname == IP_TOS) { int *tos = (int *)optval; *tos &= (IPTOS_TOS_MASK | IPTOS_PREC_MASK);
*** 479,489 **** /* * Sets SO_ECLUSIVEADDRUSE if SO_REUSEADDR is not already set. */ void setExclusiveBind(int fd) { ! int parg; int plen = sizeof(parg); int rv = 0; rv = NET_GetSockOpt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&parg, &plen); if (rv == 0 && parg == 0) { parg = 1; --- 479,489 ---- /* * Sets SO_ECLUSIVEADDRUSE if SO_REUSEADDR is not already set. */ void setExclusiveBind(int fd) { ! int parg = 0; int plen = sizeof(parg); int rv = 0; rv = NET_GetSockOpt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&parg, &plen); if (rv == 0 && parg == 0) { parg = 1;
*** 500,510 **** * Should be only called by the wrapper method NET_WinBind */ JNIEXPORT int JNICALL NET_Bind(int s, struct sockaddr *him, int len) { ! int rv; rv = bind(s, him, len); if (rv == SOCKET_ERROR) { /* * If bind fails with WSAEACCES it means that a privileged --- 500,510 ---- * Should be only called by the wrapper method NET_WinBind */ JNIEXPORT int JNICALL NET_Bind(int s, struct sockaddr *him, int len) { ! int rv = 0; rv = bind(s, him, len); if (rv == SOCKET_ERROR) { /* * If bind fails with WSAEACCES it means that a privileged
*** 530,541 **** return NET_Bind(s, him, len); } JNIEXPORT int JNICALL NET_SocketClose(int fd) { ! struct linger l; ! int ret; int len = sizeof (l); if (getsockopt(fd, SOL_SOCKET, SO_LINGER, (char *)&l, &len) == 0) { if (l.l_onoff == 0) { WSASendDisconnect(fd, NULL); } --- 530,541 ---- return NET_Bind(s, him, len); } JNIEXPORT int JNICALL NET_SocketClose(int fd) { ! struct linger l = {0, 0}; ! int ret = 0; int len = sizeof (l); if (getsockopt(fd, SOL_SOCKET, SO_LINGER, (char *)&l, &len) == 0) { if (l.l_onoff == 0) { WSASendDisconnect(fd, NULL); }