From 2ea71064adfb662af51ddbd1f73e06ad98285108 Mon Sep 17 00:00:00 2001 From: Tim Woodall Date: Thu, 6 Oct 2005 21:22:36 +0000 Subject: [PATCH] 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. --- orte/mca/pls/fork/pls_fork_module.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/orte/mca/pls/fork/pls_fork_module.c b/orte/mca/pls/fork/pls_fork_module.c index 7c7acf5168..8312e3ea38 100644 --- a/orte/mca/pls/fork/pls_fork_module.c +++ b/orte/mca/pls/fork/pls_fork_module.c @@ -209,7 +209,7 @@ static int orte_pls_fork_proc( char *param, *param2; char *uri; char **environ_copy; - + long fd, fdmax = sysconf(_SC_OPEN_MAX); #if 0 /* for gperf - setup a new directory for each executable */ char path[PATH_MAX]; @@ -327,6 +327,10 @@ static int orte_pls_fork_proc( /* setup stdout/stderr */ orte_iof_base_setup_child(&opts); + /* close all file descriptors w/ exception of stdin/stdout/stderr */ + for(fd=3; fdargv == NULL) { context->argv = malloc(sizeof(char*)*2); context->argv[0] = strdup(context->app);