Skip to content

Commit b33ff9d

Browse files
dericsmorrone
authored andcommitted
Fix use of uninitialized variable - localhost.
1 parent c0c1f38 commit b33ff9d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/ior.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -471,13 +471,6 @@ static int CountTasksPerNode(int numTasks, MPI_Comm comm)
471471
unsigned flag;
472472
int rc;
473473

474-
if (verbose >= VERBOSE_2 && firstPass) {
475-
char tmp[MAX_STR];
476-
sprintf(tmp, "task %d on %s", rank, localhost);
477-
OutputToRoot(numTasks, comm, tmp);
478-
firstPass = FALSE;
479-
}
480-
481474
rc = gethostname(localhost, MAX_STR);
482475
if (rc == -1) {
483476
/* This node won't match task 0's hostname...expect in the
@@ -489,6 +482,13 @@ static int CountTasksPerNode(int numTasks, MPI_Comm comm)
489482
perror("gethostname() failed");
490483
}
491484

485+
if (verbose >= VERBOSE_2 && firstPass) {
486+
char tmp[MAX_STR];
487+
sprintf(tmp, "task %d on %s", rank, localhost);
488+
OutputToRoot(numTasks, comm, tmp);
489+
firstPass = FALSE;
490+
}
491+
492492
/* send task 0's hostname to all tasks */
493493
if (rank == 0)
494494
strcpy(hostname0, localhost);

0 commit comments

Comments
 (0)