summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2015-07-28 22:44:29 +0200
committerbunnei <bunneidev@gmail.com>2015-07-28 22:44:29 +0200
commit4ccc171db407ededaa19a1ffec61e1a9c6daf829 (patch)
tree8f046e715c75620f6ace56f43b95eee6d407b2b2 /src/core
parentMerge pull request #998 from LittleWhite-tb/qt-continue-menu (diff)
parentSOC:U : Update deprecated function gethostbyname() to getaddrinfo() (diff)
downloadyuzu-4ccc171db407ededaa19a1ffec61e1a9c6daf829.tar
yuzu-4ccc171db407ededaa19a1ffec61e1a9c6daf829.tar.gz
yuzu-4ccc171db407ededaa19a1ffec61e1a9c6daf829.tar.bz2
yuzu-4ccc171db407ededaa19a1ffec61e1a9c6daf829.tar.lz
yuzu-4ccc171db407ededaa19a1ffec61e1a9c6daf829.tar.xz
yuzu-4ccc171db407ededaa19a1ffec61e1a9c6daf829.tar.zst
yuzu-4ccc171db407ededaa19a1ffec61e1a9c6daf829.zip
Diffstat (limited to '')
-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 d0e166fdf..d768a3fc7 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) {