Return-Path: Delivered-To: apmail-apr-cvs-archive@apr.apache.org Received: (qmail 56954 invoked by uid 500); 26 Oct 2001 19:21:29 -0000 Mailing-List: contact cvs-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Reply-To: dev@apr.apache.org Delivered-To: mailing list cvs@apr.apache.org Received: (qmail 56934 invoked from network); 26 Oct 2001 19:21:28 -0000 Date: 26 Oct 2001 18:13:02 -0000 Message-ID: <20011026181302.53747.qmail@icarus.apache.org> From: trawick@apache.org To: apr-cvs@apache.org Subject: cvs commit: apr/threadproc/unix proc.c X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N trawick 01/10/26 11:13:02 Modified: threadproc/unix proc.c Log: 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 Revision Changes Path 1.51 +6 -2 apr/threadproc/unix/proc.c Index: proc.c =================================================================== RCS file: /home/cvs/apr/threadproc/unix/proc.c,v retrieving revision 1.50 retrieving revision 1.51 diff -u -r1.50 -r1.51 --- proc.c 2001/10/23 17:30:08 1.50 +++ proc.c 2001/10/26 18:13:02 1.51 @@ -289,6 +289,12 @@ 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); @@ -312,8 +318,6 @@ exit(-1); /* We have big problems, the child should exit. */ } } - - apr_pool_cleanup_for_exec(); if ((status = limit_proc(attr)) != APR_SUCCESS) { return status;