1
1

Adding changes for issue #6303 for branch master.

Signed-off-by: Jason Williams <uberlinuxguy@gmail.com>
Этот коммит содержится в:
Jason Williams 2019-01-25 09:27:33 -05:00
родитель 352b667323
Коммит 98d81a5f7a
3 изменённых файлов: 31 добавлений и 3 удалений

Просмотреть файл

@ -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;
@ -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);
}
}

Просмотреть файл

@ -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;
@ -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);
}
}

Просмотреть файл

@ -231,6 +231,14 @@ static int close_open_file_descriptors(posix_spawn_file_actions_t *factions)
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;
@ -240,7 +248,7 @@ static int close_open_file_descriptors(posix_spawn_file_actions_t *factions)
closedir(dir);
return ORTE_ERR_TYPE_MISMATCH;
}
if (fd >=3) {
if (fd >=3 && fd != dir_scan_fd) {
posix_spawn_file_actions_addclose(factions, fd);
}
}