Skip to content

Commit

Permalink
Merge pull request #180 from jschwartz-cray/fix-179
Browse files Browse the repository at this point in the history
Fix #179.
  • Loading branch information
JulianKunkel authored Aug 31, 2019
2 parents 11fa33f + 4c3d96b commit 47695ae
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions src/ior.c
Original file line number Diff line number Diff line change
Expand Up @@ -785,8 +785,7 @@ void GetTestFileName(char *testFileName, IOR_param_t * test)
static char *PrependDir(IOR_param_t * test, char *rootDir)
{
char *dir;
char fname[MAX_STR + 1];
char *p;
char *fname;
int i;

dir = (char *)malloc(MAX_STR + 1);
Expand All @@ -806,18 +805,10 @@ static char *PrependDir(IOR_param_t * test, char *rootDir)
}

/* get file name */
strcpy(fname, rootDir);
p = fname;
while (i > 0) {
if (fname[i] == '\0' || fname[i] == '/') {
p = fname + (i + 1);
break;
}
i--;
}
fname = rootDir + i + 1;

/* create directory with rank as subdirectory */
sprintf(dir, "%s%d", dir, (rank + rankOffset) % test->numTasks);
sprintf(dir + i + 1, "%d", (rank + rankOffset) % test->numTasks);

/* dir doesn't exist, so create */
if (backend->access(dir, F_OK, test) != 0) {
Expand All @@ -834,7 +825,7 @@ static char *PrependDir(IOR_param_t * test, char *rootDir)

/* concatenate dir and file names */
strcat(dir, "/");
strcat(dir, p);
strcat(dir, fname);

return dir;
}
Expand Down

0 comments on commit 47695ae

Please sign in to comment.