Skip to content

Commit

Permalink
Update users of pmix_os_dirpath_create
Browse files Browse the repository at this point in the history
Account for possible return of PMIX_ERR_EXISTS

Signed-off-by: Ralph Castain <[email protected]>
(cherry picked from commit 964ed5f)
  • Loading branch information
rhc54 committed Dec 21, 2024
1 parent 8db155d commit fb73408
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/mca/filem/raw/filem_raw_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,8 @@ static int create_link(char *my_dir, char *path, char *link_pt)
PRTE_NAME_PRINT(PRTE_PROC_MY_NAME), link_pt, mypath, fullname));
/* create any required path to the link location */
basedir = pmix_dirname(fullname);
if (PMIX_SUCCESS != (rc = pmix_os_dirpath_create(basedir, S_IRWXU))) {
rc = pmix_os_dirpath_create(basedir, S_IRWXU);
if (PMIX_SUCCESS != rc && PMIX_ERR_EXISTS != rc) {
PMIX_ERROR_LOG(rc);
pmix_output(0, "%s Failed to symlink %s to %s", PRTE_NAME_PRINT(PRTE_PROC_MY_NAME),
mypath, fullname);
Expand Down Expand Up @@ -999,7 +1000,8 @@ static void recv_files(int status, pmix_proc_t *sender, pmix_data_buffer_t *buff
PRTE_NAME_PRINT(PRTE_PROC_MY_NAME), incoming->fullpath));
/* create the path to the target, if not already existing */
tmp = pmix_dirname(incoming->fullpath);
if (PMIX_SUCCESS != (rc = pmix_os_dirpath_create(tmp, S_IRWXU))) {
rc = pmix_os_dirpath_create(tmp, S_IRWXU);
if (PMIX_SUCCESS != rc && PMIX_ERR_EXISTS != rc) {
PMIX_ERROR_LOG(rc);
send_complete(file, PRTE_ERR_FILE_WRITE_FAILURE);
free(file);
Expand Down
6 changes: 5 additions & 1 deletion src/util/session_dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ static int _create_dir(char *directory)
int ret;

/* attempt to create it */
if (PMIX_SUCCESS != (ret = pmix_os_dirpath_create(directory, my_mode))) {
ret = pmix_os_dirpath_create(directory, my_mode);
if (PMIX_ERR_EXISTS == ret) {
// existence is good enough
ret = PMIX_SUCCESS;
} else if (PMIX_SUCCESS != ret) {
PMIX_ERROR_LOG(ret);
}
ret = prte_pmix_convert_status(ret);
Expand Down

0 comments on commit fb73408

Please sign in to comment.