aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar bunnei <bunneidev@gmail.com>2015-07-28 16:44:29 -0400
committerGravatar bunnei <bunneidev@gmail.com>2015-07-28 16:44:29 -0400
commit4ccc171db407ededaa19a1ffec61e1a9c6daf829 (patch)
tree8f046e715c75620f6ace56f43b95eee6d407b2b2
parent429b9de9a27ac037f05f41e7bcaf2213816ffaa5 (diff)
parent395e63d5aafb26fbd4c216ae7e03e58efad4ec34 (diff)
Merge pull request #899 from zawata/Winsock-Deprecation
SOC:U : Fix WinSock function deprecation
-rw-r--r--src/core/hle/service/soc_u.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/core/hle/service/soc_u.cpp b/src/core/hle/service/soc_u.cpp
index d0e166fd..d768a3fc 100644
--- a/src/core/hle/service/soc_u.cpp
+++ b/src/core/hle/service/soc_u.cpp
@@ -481,11 +481,17 @@ static void GetHostId(Service::Interface* self) {
char name[128];
gethostname(name, sizeof(name));
- hostent* host = gethostbyname(name);
- in_addr* addr = reinterpret_cast<in_addr*>(host->h_addr);
+ addrinfo hints = {};
+ addrinfo* res;
+
+ hints.ai_family = AF_INET;
+ getaddrinfo(name, NULL, &hints, &res);
+ sockaddr_in* sock_addr = reinterpret_cast<sockaddr_in*>(res->ai_addr);
+ in_addr* addr = &sock_addr->sin_addr;
cmd_buffer[2] = addr->s_addr;
cmd_buffer[1] = 0;
+ freeaddrinfo(res);
}
static void Close(Service::Interface* self) {