1
1

Merge pull request #6307 from uberlinuxguy/v4.0.x-fix-for-6303

Adding changes for issue #6303 for branch v4.0.x.
Этот коммит содержится в:
Howard Pritchard 2019-02-08 14:41:11 -07:00 коммит произвёл GitHub
родитель 85ed3f47fa 3d8ddbc136
Коммит d84322076f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
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);
}
}