diff options
author | thilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2008-10-29 15:53:46 +0000 |
---|---|---|
committer | thilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2008-10-29 15:53:46 +0000 |
commit | bd2911dd7b9cf503f7521c042195b30da597b599 (patch) | |
tree | 3bd361f3671c9efb435eced4586cda484126b889 /code/qcommon | |
parent | 7ae0a688b08936e64563d5c1b2bb885fb5b7e7ce (diff) | |
download | ioquake3-aero-bd2911dd7b9cf503f7521c042195b30da597b599.tar.gz ioquake3-aero-bd2911dd7b9cf503f7521c042195b30da597b599.zip |
Patch to make getnameinfo() call work on OpenBSD systems. Created by agent59692154@spamcorptastic.com
git-svn-id: svn://svn.icculus.org/quake3/trunk@1475 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/qcommon')
-rw-r--r-- | code/qcommon/net_ip.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/code/qcommon/net_ip.c b/code/qcommon/net_ip.c index ac78a83..05a17a4 100644 --- a/code/qcommon/net_ip.c +++ b/code/qcommon/net_ip.c @@ -339,8 +339,15 @@ static qboolean Sys_StringToSockaddr(const char *s, struct sockaddr *sadr, int s 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 @@ const char *NET_AdrToString (netadr_t a) 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 @@ void Sys_ShowIP(void) { 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); |