ws2_32: Fix FreeBSD compiling issue on ipx address structure

Francois Gouget fgouget at free.fr
Mon Jan 6 04:55:30 CST 2014


On Sun, 5 Jan 2014, Bruno Jesus wrote:

> Manually tested on PC-BSD which also shows the issue.

I think it would even work to compare sipx_network and sipx_node in one 
go. There is already code that copies them that way in 
ws_sockaddr_ws2u():
            
memcpy(&uipx->sipx_network,wsipx->sa_netnum,sizeof(uipx->sipx_network)+sizeof(uipx->sipx_node));

So we could do (compiles but not tested):

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 0391554..a92c5c3 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -1473,7 +1473,10 @@ static BOOL is_sockaddr_bound(const struct 
sockaddr *uaddr, int uaddrlen)
         {
             static const struct sockaddr_ipx emptyAddr;
             struct sockaddr_ipx *ipx = (struct sockaddr_ipx*) uaddr;
-            return ipx->sipx_port || ipx->sipx_network || memcmp(&ipx->sipx_node, &emptyAddr.sipx_node, sizeof(emptyAddr.sipx_node));
+
+            /* compare sipx_network and sipx_node in one go to ease portability */
+            return ipx->sipx_port ||
+                memcmp(&ipx->sipx_network, &emptyAddr.sipx_network, sizeof(emptyAddr.sipx_network) + sizeof(emptyAddr.sipx_node));
         }
 #endif
         case AF_INET6:

But your patch works too.


-- 
Francois Gouget <fgouget at free.fr>              http://fgouget.free.fr/
             Research is the transformation of money to knowledge.
            Innovation is the transformation of knowledge to money.
                              -- Dr. Hans Meixner



More information about the wine-devel mailing list