Skip to content

Commit

Permalink
Fix use of uninitialized variable - localhost.
Browse files Browse the repository at this point in the history
  • Loading branch information
derics authored and morrone committed Nov 21, 2012
1 parent c0c1f38 commit b33ff9d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/ior.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand Down

0 comments on commit b33ff9d

Please sign in to comment.