File ch3-fix-improper-error-handling-from-MPL_get_sockaddr.patch of Package mpich

commit c84f36fc972269c16c8ba79956f621a28c416381
Author: Hui Zhou <hzhou321@anl.gov>
Date:   Mon Nov 18 14:52:55 2019 -0600

    ch3: fix improper error handling from MPL_get_sockaddr
    
    MPL layer does not directly return mpi_errno. Use MPIR_ERR_CHKANDJUMP
    macro to create the appropriate return code. See pmodels/mpich#4318.
    
    Cherry-picked from [8d923937ec5d].

diff --git src/mpid/ch3/channels/nemesis/netmod/tcp/tcp_init.c src/mpid/ch3/channels/nemesis/netmod/tcp/tcp_init.c
index 4c2383ed8f02..bc58211eb6cc 100644
--- src/mpid/ch3/channels/nemesis/netmod/tcp/tcp_init.c
+++ 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: