Permalink
Browse files

Fix use of uninitialized variable - localhost.

  • Loading branch information...
1 parent c0c1f38 commit b33ff9d65ca4523c5d5a184ac85bec6ca6b39eab @derics derics committed with morrone Nov 21, 2012
Showing with 7 additions and 7 deletions.
  1. +7 −7 src/ior.c
View
@@ -471,13 +471,6 @@ static int CountTasksPerNode(int numTasks, MPI_Comm comm)
unsigned flag;
int rc;
- if (verbose >= VERBOSE_2 && firstPass) {
- char tmp[MAX_STR];
- sprintf(tmp, "task %d on %s", rank, localhost);
- OutputToRoot(numTasks, comm, tmp);
- firstPass = FALSE;
- }
-
rc = gethostname(localhost, MAX_STR);
if (rc == -1) {
/* This node won't match task 0's hostname...expect in the
@@ -489,6 +482,13 @@ static int CountTasksPerNode(int numTasks, MPI_Comm comm)
perror("gethostname() failed");
}
+ if (verbose >= VERBOSE_2 && firstPass) {
+ char tmp[MAX_STR];
+ sprintf(tmp, "task %d on %s", rank, localhost);
+ OutputToRoot(numTasks, comm, tmp);
+ firstPass = FALSE;
+ }
+
/* send task 0's hostname to all tasks */
if (rank == 0)
strcpy(hostname0, localhost);

0 comments on commit b33ff9d

Please sign in to comment.