From 2d8943d9206c7fd0c30a020a6ad5f172d6bfe0c1 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Fri, 28 Apr 2017 02:48:15 -0400 Subject: [PATCH] Use the OPAL function to get the hostname. --- opal/mca/btl/tcp/btl_tcp_proc.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/opal/mca/btl/tcp/btl_tcp_proc.c b/opal/mca/btl/tcp/btl_tcp_proc.c index eb8f7ccef0..65f0052d69 100644 --- a/opal/mca/btl/tcp/btl_tcp_proc.c +++ b/opal/mca/btl/tcp/btl_tcp_proc.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2014 The University of Tennessee and The University + * Copyright (c) 2004-2017 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -828,20 +828,13 @@ void mca_btl_tcp_proc_accept(mca_btl_tcp_proc_t* btl_proc, struct sockaddr* addr /* No further use of this socket. Close it */ CLOSE_THE_SOCKET(sd); { - char *addr_str=NULL, *tmp, pnet[1024]; + char *addr_str = NULL, *tmp, *pnet; for (size_t i = 0; i < btl_proc->proc_endpoint_count; i++) { mca_btl_base_endpoint_t* btl_endpoint = btl_proc->proc_endpoints[i]; if (btl_endpoint->endpoint_addr->addr_family != addr->sa_family) { continue; } - if (AF_INET == addr->sa_family) { - inet_ntop(AF_INET, (void*)(struct in_addr*)&btl_endpoint->endpoint_addr->addr_inet, pnet, 1024); - } else if (AF_INET6 == addr->sa_family) { - inet_ntop(AF_INET6, (void*)(struct in6_addr*)&btl_endpoint->endpoint_addr->addr_inet, pnet, 1024); - } else { - /* unrecognized family */ - continue; - } + pnet = opal_net_get_hostname((struct sockaddr*)&btl_endpoint->endpoint_addr->addr_inet); if (NULL == addr_str) { (void)asprintf(&tmp, "\n\t%s", pnet); } else {