Adding changes for issue #6303 for branch master.
Signed-off-by: Jason Williams <uberlinuxguy@gmail.com>
Этот коммит содержится в:
родитель
352b667323
Коммит
98d81a5f7a
@ -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);
|
||||
}
|
||||
}
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user