close all file descriptors w/ the exception of stdin/stdout/stderr
otherwise, parent's file descriptors are inherited and held open by the child even if the parent dies This commit was SVN r7652.
Этот коммит содержится в:
родитель
797922fbab
Коммит
2ea71064ad
@ -209,7 +209,7 @@ static int orte_pls_fork_proc(
|
|||||||
char *param, *param2;
|
char *param, *param2;
|
||||||
char *uri;
|
char *uri;
|
||||||
char **environ_copy;
|
char **environ_copy;
|
||||||
|
long fd, fdmax = sysconf(_SC_OPEN_MAX);
|
||||||
#if 0
|
#if 0
|
||||||
/* for gperf - setup a new directory for each executable */
|
/* for gperf - setup a new directory for each executable */
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
@ -327,6 +327,10 @@ static int orte_pls_fork_proc(
|
|||||||
/* setup stdout/stderr */
|
/* setup stdout/stderr */
|
||||||
orte_iof_base_setup_child(&opts);
|
orte_iof_base_setup_child(&opts);
|
||||||
|
|
||||||
|
/* close all file descriptors w/ exception of stdin/stdout/stderr */
|
||||||
|
for(fd=3; fd<fdmax; fd++)
|
||||||
|
close(fd);
|
||||||
|
|
||||||
if (context->argv == NULL) {
|
if (context->argv == NULL) {
|
||||||
context->argv = malloc(sizeof(char*)*2);
|
context->argv = malloc(sizeof(char*)*2);
|
||||||
context->argv[0] = strdup(context->app);
|
context->argv[0] = strdup(context->app);
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user