Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'connect.c')
-rw-r--r--connect.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/connect.c b/connect.c
index 7636bf976e..f6b8ba6fec 100644
--- a/connect.c
+++ b/connect.c
@@ -177,18 +177,11 @@ static enum protocol get_protocol(const char *name)
static const char *ai_name(const struct addrinfo *ai)
{
- static char addr[INET_ADDRSTRLEN];
- if ( AF_INET == ai->ai_family ) {
- struct sockaddr_in *in;
- in = (struct sockaddr_in *)ai->ai_addr;
- inet_ntop(ai->ai_family, &in->sin_addr, addr, sizeof(addr));
- } else if ( AF_INET6 == ai->ai_family ) {
- struct sockaddr_in6 *in;
- in = (struct sockaddr_in6 *)ai->ai_addr;
- inet_ntop(ai->ai_family, &in->sin6_addr, addr, sizeof(addr));
- } else {
+ static char addr[NI_MAXHOST];
+ if (getnameinfo(ai->ai_addr, ai->ai_addrlen, addr, sizeof(addr), NULL, 0,
+ NI_NUMERICHOST) != 0)
strcpy(addr, "(unknown)");
- }
+
return addr;
}