[PATCH] wbemprox: Use WS_AF_INET instead of AF_INET in get_ipsubnet.

Gerald Pfeifer gerald at pfeifer.com
Sat Aug 18 20:18:42 CDT 2018


This is a revised patch based on Piotr's feedback to my patch
yesterday (which doesn't show in the archive yet, so no link).


Commit 88d52edcc4d5a81965627905278d1212250ae84d

    Author: Piotr Caban <piotr at codeweavers.com>
    Date:   Wed Aug 1 17:23:29 2018 +0200

    wbemprox: Add Win32_NetworkAdapterConfiguration::IPSubnet property.
    
    Signed-off-by: Piotr Caban <piotr at codeweavers.com>
    Signed-off-by: Hans Leidekker <hans at codeweavers.com>
    Signed-off-by: Alexandre Julliard <julliard at winehq.org>

broke the build on FreeBSD 10.x and likely other versions:

    builtin.c: In function 'get_ipsubnet':
    builtin.c:2499:55: error: 'AF_INET' undeclared (first use in this function)
    2499 |         if (address->Address.lpSockaddr->sa_family == AF_INET)
         |                                                       ^~~~~~~


Using WS_AF_INET (and defining this in the __MINGW32__ case) addresses
this.  That way including sys/socket.h is also not required.

Gerald

Signed-off-by: Gerald Pfeifer <gerald at pfeifer.com>
---
 dlls/wbemprox/builtin.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c
index 72c6b4e933..9fe22d0034 100644
--- a/dlls/wbemprox/builtin.c
+++ b/dlls/wbemprox/builtin.c
@@ -37,6 +37,7 @@
 #ifdef __MINGW32__
 # include "winsock2.h"
 # include "ws2tcpip.h"
+# define WS_AF_INET AF_INET
 # define WS_AF_UNSPEC AF_UNSPEC
 # define WS_NI_MAXHOST NI_MAXHOST
 # define WS_NI_NAMEREQD NI_NAMEREQD
@@ -2496,14 +2497,14 @@ static struct array *get_ipsubnet( IP_ADAPTER_UNICAST_ADDRESS_LH *list )
     }
     for (address = list; address; address = address->Next)
     {
-        if (address->Address.lpSockaddr->sa_family == AF_INET)
+        if (address->Address.lpSockaddr->sa_family == WS_AF_INET)
         {
             WCHAR buf[INET_ADDRSTRLEN];
             SOCKADDR_IN addr;
             ULONG buflen = sizeof(buf)/sizeof(buf[0]);
 
             memset( &addr, 0, sizeof(addr) );
-            addr.sin_family = AF_INET;
+            addr.sin_family = WS_AF_INET;
             if (ConvertLengthToIpv4Mask( address->OnLinkPrefixLength, &addr.sin_addr.S_un.S_addr ) != NO_ERROR
                     || WSAAddressToStringW( (SOCKADDR*)&addr, sizeof(addr), NULL, buf, &buflen))
                 ptr[i] = NULL;
-- 
2.17.0



More information about the wine-devel mailing list