r1475 - trunk/code/qcommon

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Oct 29 11:53:46 EDT 2008


Author: thilo
Date: 2008-10-29 11:53:46 -0400 (Wed, 29 Oct 2008)
New Revision: 1475

Modified:
   trunk/code/qcommon/net_ip.c
Log:
Patch to make getnameinfo() call work on OpenBSD systems. Created by agent59692154 at spamcorptastic.com


Modified: trunk/code/qcommon/net_ip.c
===================================================================
--- trunk/code/qcommon/net_ip.c	2008-10-24 07:08:52 UTC (rev 1474)
+++ trunk/code/qcommon/net_ip.c	2008-10-29 15:53:46 UTC (rev 1475)
@@ -339,8 +339,15 @@
 Sys_SockaddrToString
 =============
 */
-static void Sys_SockaddrToString(char *dest, int destlen, struct sockaddr *input, int inputlen)
+static void Sys_SockaddrToString(char *dest, int destlen, struct sockaddr *input)
 {
+	socklen_t inputlen;
+
+	if (input->sa_family == AF_INET6)
+		inputlen = sizeof(struct sockaddr_in6);
+	else
+		inputlen = sizeof(struct sockaddr_in);
+
 	getnameinfo(input, inputlen, dest, destlen, NULL, 0, NI_NUMERICHOST);
 }
 
@@ -423,7 +430,7 @@
 	
 		memset(&sadr, 0, sizeof(sadr));
 		NetadrToSockadr(&a, (struct sockaddr *) &sadr);
-		Sys_SockaddrToString(s, sizeof(s), (struct sockaddr *) &sadr, sizeof(sadr));
+		Sys_SockaddrToString(s, sizeof(s), (struct sockaddr *) &sadr);
 	}
 
 	return s;
@@ -758,7 +765,7 @@
 
 	for(i = 0; i < numIP; i++)
 	{
-		Sys_SockaddrToString(addrbuf, sizeof(addrbuf), (struct sockaddr *) &localIP[i].addr, sizeof((*localIP).addr));
+		Sys_SockaddrToString(addrbuf, sizeof(addrbuf), (struct sockaddr *) &localIP[i].addr);
 
 		if(localIP[i].type == NA_IP)
 			Com_Printf( "IP: %s\n", addrbuf);




More information about the quake3-commits mailing list