From 892932d9e23aa417f0f067cbd628868eb5bc8e48 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Fri, 30 Dec 2016 12:19:59 +0100 Subject: inet: fix getnameinfo problem found by new test cases Follow documented behaviour: http://man7.org/linux/man-pages/man3/getnameinfo.3.html Sync with GNU libc behaviour. --- libc/inet/resolv.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index aa81bebed..c05f18980 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -1746,6 +1746,9 @@ int getnameinfo(const struct sockaddr *sa, if (sa == NULL || addrlen < sizeof(sa_family_t)) return EAI_FAMILY; + if ((flags & NI_NAMEREQD) && host == NULL && serv == NULL) + return EAI_NONAME; + if (sa->sa_family == AF_LOCAL) /* valid */; #ifdef __UCLIBC_HAS_IPV4__ else if (sa->sa_family == AF_INET) { -- cgit v1.2.3