Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion orte/mca/odls/alps/odls_alps_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,15 @@ static int close_open_file_descriptors(int write_fd,
return ORTE_ERR_FILE_OPEN_FAILURE;
}
struct dirent *files;

/* grab the fd of the opendir above so we don't close in the
* middle of the scan. */
int dir_scan_fd = dirfd(dir);
if(dir_scan_fd < 0 ) {
return ORTE_ERR_FILE_OPEN_FAILURE;
}


while (NULL != (files = readdir(dir))) {
if (!isdigit(files->d_name[0])) {
continue;
Expand All @@ -311,7 +320,8 @@ static int close_open_file_descriptors(int write_fd,
#if OPAL_PMIX_V1
fd != opts.p_internal[1] &&
#endif
fd != write_fd) {
fd != write_fd &&
fd != dir_scan_fd) {
close(fd);
}
}
Expand Down
12 changes: 11 additions & 1 deletion orte/mca/odls/default/odls_default_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,15 @@ static int close_open_file_descriptors(int write_fd,
return ORTE_ERR_FILE_OPEN_FAILURE;
}
struct dirent *files;

/* grab the fd of the opendir above so we don't close in the
* middle of the scan. */
int dir_scan_fd = dirfd(dir);
if(dir_scan_fd < 0 ) {
return ORTE_ERR_FILE_OPEN_FAILURE;
}


while (NULL != (files = readdir(dir))) {
if (!isdigit(files->d_name[0])) {
continue;
Expand All @@ -315,7 +324,8 @@ static int close_open_file_descriptors(int write_fd,
#if OPAL_PMIX_V1
fd != opts.p_internal[1] &&
#endif
fd != write_fd) {
fd != write_fd &&
fd != dir_scan_fd) {
close(fd);
}
}
Expand Down