Fix use of uninitialized variable - localhost.

master
derics 2012-11-20 22:42:28 -05:00 committed by Christopher J. Morrone
parent c0c1f38a51
commit b33ff9d65c
1 changed files with 7 additions and 7 deletions

View File

@ -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);