mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:57:45 +00: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:
parent
38619a9f24
commit
cd432860d8
1 changed files with 7 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue