diff options
author | Gunnar Beutner <gunnar@beutner.name> | 2021-04-14 04:31:20 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-04-14 13:13:06 +0200 |
commit | 7d12c08bec88d21db93103ecfd19bf3e878c33c8 (patch) | |
tree | 604650698b0eeb42e04391aa35ca6099db3f62f1 /Userland/Libraries | |
parent | ea6d0aa1d47175c248368292bb2e687c73e1d37a (diff) | |
download | serenity-7d12c08bec88d21db93103ecfd19bf3e878c33c8.zip |
LibC: Add definition for the NI_NAMEREQD macro
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibC/netdb.cpp | 5 | ||||
-rw-r--r-- | Userland/Libraries/LibC/netdb.h | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/Userland/Libraries/LibC/netdb.cpp b/Userland/Libraries/LibC/netdb.cpp index f853c42be2..7231a1ac69 100644 --- a/Userland/Libraries/LibC/netdb.cpp +++ b/Userland/Libraries/LibC/netdb.cpp @@ -794,14 +794,15 @@ const char* gai_strerror(int errcode) int getnameinfo(const struct sockaddr* __restrict addr, socklen_t addrlen, char* __restrict host, socklen_t hostlen, char* __restrict serv, socklen_t servlen, int flags) { - (void)flags; - if (addr->sa_family != AF_INET || addrlen < sizeof(sockaddr_in)) return EAI_FAMILY; const sockaddr_in* sin = reinterpret_cast<const sockaddr_in*>(addr); if (host && hostlen > 0) { + if (flags & NI_NAMEREQD) + dbgln("getnameinfo flag NI_NAMEREQD not implemented"); + if (!inet_ntop(AF_INET, &sin->sin_addr, host, hostlen)) { if (errno == ENOSPC) return EAI_OVERFLOW; diff --git a/Userland/Libraries/LibC/netdb.h b/Userland/Libraries/LibC/netdb.h index 4560466fa4..75ba1aa8c7 100644 --- a/Userland/Libraries/LibC/netdb.h +++ b/Userland/Libraries/LibC/netdb.h @@ -112,6 +112,7 @@ struct addrinfo { #define NI_NUMERICHOST 1 #define NI_NUMERICSERV 2 +#define NI_NAMEREQD 3 int getaddrinfo(const char* __restrict node, const char* __restrict service, const struct addrinfo* __restrict hints, struct addrinfo** __restrict res); void freeaddrinfo(struct addrinfo* res); |