summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorzawata <zawataza@gmail.com>2015-07-01 01:59:27 +0200
committerzawata <zawataza@gmail.com>2015-07-20 04:32:12 +0200
commit395e63d5aafb26fbd4c216ae7e03e58efad4ec34 (patch)
tree1d51bfcb42b398cb1058eda3c43c558676bcbd0e /src/core
parentMerge pull request #884 from chinhodado/patch-1 (diff)
downloadyuzu-395e63d5aafb26fbd4c216ae7e03e58efad4ec34.tar
yuzu-395e63d5aafb26fbd4c216ae7e03e58efad4ec34.tar.gz
yuzu-395e63d5aafb26fbd4c216ae7e03e58efad4ec34.tar.bz2
yuzu-395e63d5aafb26fbd4c216ae7e03e58efad4ec34.tar.lz
yuzu-395e63d5aafb26fbd4c216ae7e03e58efad4ec34.tar.xz
yuzu-395e63d5aafb26fbd4c216ae7e03e58efad4ec34.tar.zst
yuzu-395e63d5aafb26fbd4c216ae7e03e58efad4ec34.zip
Diffstat (limited to 'src/core')
-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 1e0f5df9b..3f0c5e388 100644
--- a/src/core/hle/service/soc_u.cpp
+++ b/src/core/hle/service/soc_u.cpp
@@ -469,11 +469,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) {