From a5674545eaeced0b896378e316e3254e67767c31 Mon Sep 17 00:00:00 2001 From: Packit Service Date: Dec 12 2020 01:19:41 +0000 Subject: Apply patch 4320.patch patch_name: 4320.patch present_in_specfile: true --- diff --git a/src/mpid/ch3/channels/nemesis/netmod/tcp/tcp_init.c b/src/mpid/ch3/channels/nemesis/netmod/tcp/tcp_init.c index 4c2383e..bc58211 100644 --- a/src/mpid/ch3/channels/nemesis/netmod/tcp/tcp_init.c +++ b/src/mpid/ch3/channels/nemesis/netmod/tcp/tcp_init.c @@ -307,8 +307,9 @@ static int GetSockInterfaceAddr(int myRank, char *ifname, int maxIfname, if (MPIR_CVAR_NEMESIS_TCP_NETWORK_IFACE) { char s[100]; int len; - mpi_errno = MPL_get_sockaddr_iface(MPIR_CVAR_NEMESIS_TCP_NETWORK_IFACE, p_addr); - MPIR_ERR_CHKANDJUMP1(mpi_errno, mpi_errno, MPI_ERR_OTHER, "**iface_notfound", "**iface_notfound %s", MPIR_CVAR_NEMESIS_TCP_NETWORK_IFACE); + int ret = MPL_get_sockaddr_iface(MPIR_CVAR_NEMESIS_TCP_NETWORK_IFACE, p_addr); + MPIR_ERR_CHKANDJUMP1(ret != 0, mpi_errno, MPI_ERR_OTHER, "**iface_notfound", + "**iface_notfound %s", MPIR_CVAR_NEMESIS_TCP_NETWORK_IFACE); MPL_sockaddr_to_str(p_addr, s, 100); MPL_DBG_MSG_FMT(MPIDI_CH3_DBG_CONNECT, VERBOSE, (MPL_DBG_FDEST, @@ -354,12 +355,13 @@ static int GetSockInterfaceAddr(int myRank, char *ifname, int maxIfname, ifname_string = ifname; - /* If we didn't find a specific name, then try to get an IP address - directly from the available interfaces, if that is supported on - this platform. Otherwise, we'll drop into the next step that uses - the ifname */ - mpi_errno = MPL_get_sockaddr_iface( NULL, p_addr); - if (mpi_errno) MPIR_ERR_POP(mpi_errno); + /* If we didn't find a specific name, then try to get an IP address + * directly from the available interfaces, if that is supported on + * this platform. Otherwise, we'll drop into the next step that uses + * the ifname */ + int ret = MPL_get_sockaddr_iface(NULL, p_addr); + MPIR_ERR_CHKANDJUMP1(ret != 0, mpi_errno, MPI_ERR_OTHER, "**iface_notfound", + "**iface_notfound %s", NULL); ifaddrFound = 1; } else { @@ -369,8 +371,9 @@ static int GetSockInterfaceAddr(int myRank, char *ifname, int maxIfname, /* If we don't have an IP address, try to get it from the name */ if (!ifaddrFound) { - mpi_errno = MPL_get_sockaddr(ifname_string, p_addr); - MPIR_ERR_CHKANDJUMP2(mpi_errno, mpi_errno, MPI_ERR_OTHER, "**gethostbyname", "**gethostbyname %s %d", ifname_string, h_errno); + int ret = MPL_get_sockaddr(ifname_string, p_addr); + MPIR_ERR_CHKANDJUMP2(ret != 0, mpi_errno, MPI_ERR_OTHER, "**gethostbyname", + "**gethostbyname %s %d", ifname_string, h_errno); } fn_exit: diff --git a/src/mpl/include/mpl_sockaddr.h b/src/mpl/include/mpl_sockaddr.h index c0eb749..a9860c1 100644 --- a/src/mpl/include/mpl_sockaddr.h +++ b/src/mpl/include/mpl_sockaddr.h @@ -21,6 +21,9 @@ typedef struct sockaddr_storage MPL_sockaddr_t; +/* The following functions when return an int, it returns 0 on success, + * non-zero indicates error. It is consistent with posix socket functions. + */ void MPL_sockaddr_set_aftype(int type); int MPL_get_sockaddr(const char *s_hostname, MPL_sockaddr_t * p_addr); int MPL_get_sockaddr_direct(int type, MPL_sockaddr_t * p_addr); diff --git a/src/pmi/simple/simple_pmi.c b/src/pmi/simple/simple_pmi.c index df37a86..7f660bd 100644 --- a/src/pmi/simple/simple_pmi.c +++ b/src/pmi/simple/simple_pmi.c @@ -881,7 +881,7 @@ static int PMII_Connect_to_pm(char *hostname, int portnum) int q_wait = 1; ret = MPL_get_sockaddr(hostname, &addr); - if (!ret) { + if (ret) { PMIU_printf(1, "Unable to get host entry for %s\n", hostname); return PMI_FAIL; }