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:
parent
38619a9f24
commit
cd432860d8
Notes:
sideshowbarker
2024-07-18 19:22:37 +09:00
Author: https://github.com/gunnarbeutner
Commit: cd432860d8
Pull-request: https://github.com/SerenityOS/serenity/pull/6497
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