aboutsummaryrefslogtreecommitdiff
path: root/inet/getnameinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'inet/getnameinfo.c')
-rw-r--r--inet/getnameinfo.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/inet/getnameinfo.c b/inet/getnameinfo.c
index 50240383..db6b5c7 100644
--- a/inet/getnameinfo.c
+++ b/inet/getnameinfo.c
@@ -178,6 +178,9 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
if (sa == NULL || addrlen < sizeof (sa_family_t))
return EAI_FAMILY;
+ if ((flags & NI_NAMEREQD) && host == NULL && serv == NULL)
+ return EAI_NONAME;
+
switch (sa->sa_family)
{
case AF_LOCAL: