From: havoc Date: Thu, 1 Apr 2004 22:10:17 +0000 (+0000) Subject: fix the namelen parameter in the getsockname call X-Git-Tag: xonotic-v0.1.0preview~5947 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=939e346baed8672847011a11bcf1cce9e01ae77e;p=xonotic%2Fdarkplaces.git fix the namelen parameter in the getsockname call git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4073 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/lhnet.c b/lhnet.c index 267dc462..3af27a30 100644 --- a/lhnet.c +++ b/lhnet.c @@ -457,9 +457,10 @@ lhnetsocket_t *LHNET_OpenSocket_Connectionless(lhnetaddress_t *address) if (ioctl(lhnetsocket->inetsocket, FIONBIO, &_true) != -1) #endif { - if (bind(lhnetsocket->inetsocket, (void *)&lhnetsocket->address.addressdata, address->addresstype == LHNETADDRESSTYPE_INET6 ? sizeof(lhnetsocket->address.addressdata.inet6) : sizeof(lhnetsocket->address.addressdata.inet4)) != -1) + size_t namelen = address->addresstype == LHNETADDRESSTYPE_INET6 ? sizeof(lhnetsocket->address.addressdata.inet6) : sizeof(lhnetsocket->address.addressdata.inet4); + if (bind(lhnetsocket->inetsocket, (void *)&lhnetsocket->address.addressdata, namelen) != -1) { - getsockname(lhnetsocket->inetsocket, (void *)&lhnetsocket->address.addressdata, address->addresstype == LHNETADDRESSTYPE_INET6 ? sizeof(lhnetsocket->address.addressdata.inet6) : sizeof(lhnetsocket->address.addressdata.inet4)); + getsockname(lhnetsocket->inetsocket, (void *)&lhnetsocket->address.addressdata, &namelen); lhnetsocket->next = &lhnet_socketlist; lhnetsocket->prev = lhnetsocket->next->prev; lhnetsocket->next->prev = lhnetsocket;