[mpich2-commits] r7954 - mpich2/trunk/src/pm/hydra/utils/sock

balaji at mcs.anl.gov balaji at mcs.anl.gov
Sun Feb 13 00:42:47 CST 2011


Author: balaji
Date: 2011-02-13 00:42:47 -0600 (Sun, 13 Feb 2011)
New Revision: 7954

Modified:
   mpich2/trunk/src/pm/hydra/utils/sock/sock.c
Log:
Bug-fix: If the socket read returned an error, don't add it to the
length of data read.

No reviewer.

Modified: mpich2/trunk/src/pm/hydra/utils/sock/sock.c
===================================================================
--- mpich2/trunk/src/pm/hydra/utils/sock/sock.c	2011-02-13 06:42:43 UTC (rev 7953)
+++ mpich2/trunk/src/pm/hydra/utils/sock/sock.c	2011-02-13 06:42:47 UTC (rev 7954)
@@ -240,7 +240,7 @@
         do {
             tmp = read(fd, (char *) buf + *recvd, maxlen - *recvd);
             if (tmp < 0) {
-                if ((errno == ECONNRESET) || (errno == EINTR && fd == STDIN_FILENO)) {
+                if (errno == ECONNRESET || fd == STDIN_FILENO) {
                     /* If the remote end closed the socket or if we
                      * get an EINTR on stdin, set the socket to be
                      * closed and jump out */
@@ -252,7 +252,6 @@
         } while (tmp < 0 && errno == EINTR);
 
         if (tmp < 0) {
-            *recvd = tmp;
             HYDU_ERR_SETANDJUMP(status, HYD_SOCK_ERROR, "read error (%s)\n",
                                 HYDU_strerror(errno));
         }
@@ -260,7 +259,9 @@
             *closed = 1;
             goto fn_exit;
         }
-        *recvd += tmp;
+        else {
+            *recvd += tmp;
+        }
 
         if (flag != HYDU_SOCK_COMM_MSGWAIT || *recvd == maxlen)
             break;



More information about the mpich2-commits mailing list