1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 02:13:56 +09:00

LibC: Additional functionality for getaddrinfo()

When node is NULL and AI_PASSIVE is specified we are supposed to use
the "any" address, otherwise we should use the loopback address.
This commit is contained in:
Gunnar Beutner 2021-04-19 20:33:33 +02:00 committed by Andreas Kling
parent 38619a9f24
commit cd432860d8
Notes: sideshowbarker 2024-07-18 19:22:37 +09:00

View file

@ -667,6 +667,13 @@ int getaddrinfo(const char* __restrict node, const char* __restrict service, con
if (hints && hints->ai_family != AF_INET && hints->ai_family != AF_UNSPEC)
return EAI_FAMILY;
if (!node) {
if (hints && hints->ai_flags & AI_PASSIVE)
node = "0.0.0.0";
else
node = "127.0.0.1";
}
auto host_ent = gethostbyname(node);
if (!host_ent)
return EAI_FAIL;