diff options
Diffstat (limited to 'Userland/Libraries/LibC/netdb.cpp')
-rw-r--r-- | Userland/Libraries/LibC/netdb.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Userland/Libraries/LibC/netdb.cpp b/Userland/Libraries/LibC/netdb.cpp index 7231a1ac69..cd43bb834b 100644 --- a/Userland/Libraries/LibC/netdb.cpp +++ b/Userland/Libraries/LibC/netdb.cpp @@ -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; |