[mpich2-commits] r4169 - mpich2/trunk/src/pm/hydra/utils/launch

balaji at mcs.anl.gov balaji at mcs.anl.gov
Sun Mar 22 23:53:57 CDT 2009


Author: balaji
Date: 2009-03-22 23:53:56 -0500 (Sun, 22 Mar 2009)
New Revision: 4169

Modified:
   mpich2/trunk/src/pm/hydra/utils/launch/allocate.c
Log:
Dealing with C's weird problems with reading text files with and
without a new line at the end.


Modified: mpich2/trunk/src/pm/hydra/utils/launch/allocate.c
===================================================================
--- mpich2/trunk/src/pm/hydra/utils/launch/allocate.c	2009-03-23 03:57:06 UTC (rev 4168)
+++ mpich2/trunk/src/pm/hydra/utils/launch/allocate.c	2009-03-23 04:53:56 UTC (rev 4169)
@@ -247,10 +247,11 @@
 
         total_count = 0;
         while (!feof(fp)) {
+            line[0] = 0;
             if ((fscanf(fp, "%s", line) < 0) && errno)
                 HYDU_ERR_SETANDJUMP1(status, HYD_INTERNAL_ERROR,
                                      "unable to read input line (errno: %d)\n", errno);
-            if (feof(fp))
+            if (line[0] == 0)
                 break;
 
             hostname = strtok(line, ":");



More information about the mpich2-commits mailing list