From cvs-return-2637-apmail-apr-cvs-archive=apr.apache.org@apr.apache.org Tue Jan 08 04:24:36 2002 Return-Path: Delivered-To: apmail-apr-cvs-archive@apr.apache.org Received: (qmail 2635 invoked by uid 500); 8 Jan 2002 04:24:35 -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 2620 invoked from network); 8 Jan 2002 04:24:35 -0000 Date: 8 Jan 2002 04:24:24 -0000 Message-ID: <20020108042424.75837.qmail@icarus.apache.org> From: wrowe@apache.org To: apr-cvs@apache.org Subject: cvs commit: apr/file_io/unix filedup.c X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N wrowe 02/01/07 20:24:24 Modified: file_io/unix filedup.c Log: Still, the problem lingers. There is nothing wrong, AFAICT, with leaving fd 0..2 open always. Otherwise, another process that forks ends up with 'something else' in fd 2 (or 1, or 0) Revision Changes Path 1.40 +4 -4 apr/file_io/unix/filedup.c Index: filedup.c =================================================================== RCS file: /home/cvs/apr/file_io/unix/filedup.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- filedup.c 8 Jan 2002 04:17:15 -0000 1.39 +++ filedup.c 8 Jan 2002 04:24:24 -0000 1.40 @@ -92,14 +92,14 @@ /* make sure unget behavior is consistent */ (*new_file)->ungetchar = old_file->ungetchar; /* apr_file_dup() clears the inherit attribute, user must call - * apr_file_set_inherit() again on the dupped handle, as necessary, - * unless you have dup2'ed fd 0-2 (stdin, stdout or stderr) which - * should never, never, never close on fork() + * apr_file_set_inherit() again on the dupped handle, as necessary. + * If the user has dup2'ed fd 0-2 (stdin, stdout or stderr) we will + * never, never, never close the handle, under any circumstance. */ if (have_file && ((*new_file)->filedes >= 0) && ((*new_file)->filedes <= 2)) { (*new_file)->flags = old_file->flags | APR_INHERIT; apr_pool_cleanup_register((*new_file)->cntxt, (void *)(*new_file), - apr_unix_file_cleanup, apr_pool_cleanup_null); + apr_pool_cleanup_null, apr_pool_cleanup_null); } else { (*new_file)->flags = old_file->flags & ~APR_INHERIT;