提交 e2cc0bee 编写于 作者: R Rich Felker

return the requested string as the "canonical name" for numeric addresses

previously NULL was returned in ai_canonname, resulting in crashes in
some callers. this behavior was incorrect. note however that the new
behavior differs from glibc, which performs reverse dns lookups. POSIX
is very clear that a reverse DNS lookup must not be performed for
numeric addresses.
上级 d4fbebe1
......@@ -117,6 +117,7 @@ int getaddrinfo(const char *host, const char *serv, const struct addrinfo *hint,
buf->ai.ai_addr = (void *)&buf->sa;
buf->ai.ai_addrlen = family==AF_INET6 ? sizeof sa.sin6 : sizeof sa.sin;
buf->ai.ai_family = family;
buf->ai.ai_canonname = (char *)host;
buf->sa = sa;
buf->sa.sin.sin_port = port;
*res = &buf->ai;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册