aboutsummaryrefslogtreecommitdiff
path: root/threadproc/unix/proc.c
diff options
context:
space:
mode:
authorJeff Trawick <trawick@apache.org>2001-10-26 18:13:02 +0000
committerJeff Trawick <trawick@apache.org>2001-10-26 18:13:02 +0000
commit121a2a9d7384e86e691659a6f4b7c49f8b5586d0 (patch)
tree18068c070eb6eb429fa661f9c2c18ccb3f89f86d /threadproc/unix/proc.c
parentdff583316732d4545428110b8354f1f6c22389db (diff)
downloadapr-121a2a9d7384e86e691659a6f4b7c49f8b5586d0.tar.gz
apr-121a2a9d7384e86e691659a6f4b7c49f8b5586d0.zip
apr_proc_create():
do exec cleanup before duping pipes to fds 0-2; otherwise, any files cleaned up with those fds will hose our pipes; typical symptom is APR_EOF in the parent when trying to read child output git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@62465 13f79535-47bb-0310-9956-ffa450edef68
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;
}