Return-Path: Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 64958 invoked by uid 500); 21 Mar 2003 19:55:06 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 64937 invoked from network); 21 Mar 2003 19:55:06 -0000 Errors-To: Message-Id: <5.2.0.9.2.20030321135428.011e4de0@pop3.rowe-clan.net> X-Sender: wrowe%rowe-clan.net@pop3.rowe-clan.net X-Mailer: QUALCOMM Windows Eudora Version 5.2.0.9 Date: Fri, 21 Mar 2003 13:56:52 -0600 To: dev@httpd.apache.org From: "William A. Rowe, Jr." Subject: Re: cvs commit: httpd-2.0/server/mpm/worker pod.c Cc: dev@httpd.apache.org, dev@apr.apache.org In-Reply-To: <3E7B635D.1050205@attglobal.net> References: <5.2.0.9.2.20030321113401.0235e9c0@pop3.rowe-clan.net> <20030321162355.GG30312@redhat.com> <0CD4F2EE-5B4C-11D7-829A-000393B3C494@clove.org> <3E7B3A8D.9060404@attglobal.net> <20030321162355.GG30312@redhat.com> <5.2.0.9.2.20030321113401.0235e9c0@pop3.rowe-clan.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=====================_218345859==_" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N --=====================_218345859==_ Content-Type: text/plain; charset="us-ascii" At 01:09 PM 3/21/2003, Jeff Trawick wrote: >I'm a bit nervous about the existing/new special handling for descriptors 0-2. Ok, here is a patch that uses the target file's inherit and noclose flag bits for apr_file_dup2(), and leaves apr_file_dup() results as never inherited and always registering a cleanup. Would this patch satisfy your concerns? Does this patch resolve the new misbehavior? Bill --=====================_218345859==_ Content-Type: text/plain; charset="us-ascii" Content-Disposition: attachment; filename="apr_dupfix.patch" Index: file_io/unix/filedup.c =================================================================== RCS file: /home/cvs/apr/file_io/unix/filedup.c,v retrieving revision 1.60 diff -u -r1.60 filedup.c --- file_io/unix/filedup.c 19 Mar 2003 10:17:26 -0000 1.60 +++ file_io/unix/filedup.c 21 Mar 2003 17:31:58 -0000 @@ -117,16 +117,25 @@ /* make sure unget behavior is consistent */ (*new_file)->ungetchar = old_file->ungetchar; - /* apr_file_dup() clears the inherit attribute for normal files, - * but sets the inherit attribute for std[out,in,err] fd's. - * The user must call apr_file_inherit_[un]set() on the dupped - * apr_file_t when desired. - */ - if ((*new_file)->filedes <= 2) { - (*new_file)->flags = old_file->flags | APR_INHERIT; + if (which_dup == 1) { + /* apr_file_dup() retains all old_file flags with the exceptions + * of APR_INHERIT and APR_FILE_NOCLEANUP. + * The user must call apr_file_inherit_set() on the dupped + * apr_file_t when desired. + */ + (*new_file)->flags = old_file->flags + & ~(APR_INHERIT | APR_FILE_NOCLEANUP); + } } - else { - (*new_file)->flags = old_file->flags & ~APR_INHERIT; + else /* which_dup == 2 */ { + /* apr_file_dup2() must respect the original settings for the + * new_file->flags inheritence. If there is no cleanup, we + * should be finished already, otherwise fall through to the + * apr_pool_cleanup_register + */ + if ((*new_file)->flags & APR_FILE_NOCLEANUP) { + return APR_SUCCESS; + } } apr_pool_cleanup_register((*new_file)->pool, (void *)(*new_file), --=====================_218345859==_ Content-Type: text/plain; charset="us-ascii" --=====================_218345859==_--