File pmi-fix-a-wrong-condition-checking-return-of-MPL_get_sockaddr.patch of Package mpich

commit 5024f130a96c5fb666158fb9f20d1260d0243d5c
Author: Hui Zhou <hzhou321@anl.gov>
Date:   Wed Jan 15 13:29:56 2020 -0600

    pmi: fix a wrong condition checking return of MPL_get_sockaddr
    
    Cherry-picked from [3e6af3c2fbaf]. See pmodels/mpich#4318.

diff --git src/mpl/include/mpl_sockaddr.h src/mpl/include/mpl_sockaddr.h
index c0eb7494193c..a9860c135337 100644
--- src/mpl/include/mpl_sockaddr.h
+++ 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 src/pmi/simple/simple_pmi.c src/pmi/simple/simple_pmi.c
index df37a8689ffb..7f660bdac9cb 100644
--- src/pmi/simple/simple_pmi.c
+++ 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;
     }