Skip to content

Commit

Permalink
Quick fix: save the errno from the mkdir call as the call to stat wil…
Browse files Browse the repository at this point in the history
…l likely overwrite it

Signed-off-by: Ralph Castain <rhc@open-mpi.org>
(cherry picked from commit 6da4dbb)
  • Loading branch information
Ralph Castain committed Jan 18, 2017
1 parent c722fb9 commit 867c841
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions opal/util/os_dirpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,11 @@ int opal_os_dirpath_create(const char *path, const mode_t mode)
}

/* Now that we have the name, try to create it */
ret = mkdir(tmp, mode);
mkdir(tmp, mode);
ret = errno; // save the errno for an error msg, if needed
if (0 != stat(tmp, &buf)) {
opal_show_help("help-opal-util.txt", "mkdir-failed", true,
tmp, strerror(errno));
tmp, strerror(ret));
opal_argv_free(parts);
free(tmp);
return OPAL_ERROR;
Expand Down

0 comments on commit 867c841

Please sign in to comment.