aboutsummaryrefslogtreecommitdiff
path: root/threadproc/unix/proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'threadproc/unix/proc.c')
-rw-r--r--threadproc/unix/proc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/threadproc/unix/proc.c b/threadproc/unix/proc.c
index 736b72696..b260a3216 100644
--- a/threadproc/unix/proc.c
+++ b/threadproc/unix/proc.c
@@ -289,6 +289,12 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, const char *progname,
else if (new->pid == 0) {
int status;
/* child process */
+
+ /* do exec cleanup before duping pipes to fds 0-2; otherwise,
+ * any files cleaned up with those fds will hose our pipes
+ */
+ apr_pool_cleanup_for_exec();
+
if (attr->child_in) {
apr_file_close(attr->parent_in);
dup2(attr->child_in->filedes, STDIN_FILENO);
@@ -313,8 +319,6 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, const char *progname,
}
}
- apr_pool_cleanup_for_exec();
-
if ((status = limit_proc(attr)) != APR_SUCCESS) {
return status;
}