Bruno Jesus : ws2_32: Use unsigned interface index on interface_bind_check.
Alexandre Julliard
julliard at winehq.org
Thu May 11 15:07:29 CDT 2017
Module: wine
Branch: master
Commit: 1639c23cae273acd5977c454d1c8f29201e4480f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1639c23cae273acd5977c454d1c8f29201e4480f
Author: Bruno Jesus <bjesus at codeweavers.com>
Date: Wed May 10 22:46:31 2017 -0300
ws2_32: Use unsigned interface index on interface_bind_check.
Signed-off-by: Bruno Jesus <bjesus at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ws2_32/socket.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 9d27fab..f6db832 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -3671,7 +3671,8 @@ static void interface_bind_check(int fd, struct sockaddr_in *addr)
#if !defined(IP_BOUND_IF) && !defined(LINUX_BOUND_IF)
return;
#else
- int ifindex;
+ unsigned int ifindex;
+ int ret;
socklen_t len;
/* Check for IPv4, address 0.0.0.0 and UDP socket */
@@ -3680,15 +3681,14 @@ static void interface_bind_check(int fd, struct sockaddr_in *addr)
if (_get_fd_type(fd) != SOCK_DGRAM)
return;
- ifindex = -1;
len = sizeof(ifindex);
#if defined(IP_BOUND_IF)
- getsockopt(fd, IPPROTO_IP, IP_BOUND_IF, &ifindex, &len);
+ ret = getsockopt(fd, IPPROTO_IP, IP_BOUND_IF, &ifindex, &len);
#elif defined(LINUX_BOUND_IF)
- getsockopt(fd, IPPROTO_IP, IP_UNICAST_IF, &ifindex, &len);
- if (ifindex > 0) ifindex = ntohl(ifindex);
+ ret = getsockopt(fd, IPPROTO_IP, IP_UNICAST_IF, &ifindex, &len);
+ if (!ret) ifindex = ntohl(ifindex);
#endif
- if (ifindex > 0)
+ if (!ret)
{
PIP_ADAPTER_INFO adapters, adapter;
DWORD adap_size;
More information about the wine-cvs
mailing list