Return-Path: Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: (qmail 19817 invoked from network); 6 Jan 2008 17:35:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Jan 2008 17:35:35 -0000 Received: (qmail 66531 invoked by uid 500); 6 Jan 2008 17:35:24 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 66481 invoked by uid 500); 6 Jan 2008 17:35:24 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 66470 invoked by uid 99); 6 Jan 2008 17:35:24 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 06 Jan 2008 09:35:24 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 06 Jan 2008 17:35:20 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 211B81A9850; Sun, 6 Jan 2008 09:35:12 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r609354 - /httpd/httpd/trunk/server/mpm/winnt/mpm_winnt.c Date: Sun, 06 Jan 2008 17:35:11 -0000 To: cvs@httpd.apache.org From: wrowe@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080106173512.211B81A9850@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: wrowe Date: Sun Jan 6 09:35:03 2008 New Revision: 609354 URL: http://svn.apache.org/viewvc?rev=609354&view=rev Log: Resolve console-mode stdout file descriptor issues for mod_perl by replacing it in lockstep with unix stdout replacement (in pre_config). Only an undetached server (console mode single process/debug) will retain the original stdout, just as on unix. Inspired by research of Tom and myself (CHANGES to credit both). PR: 43534 Modified: httpd/httpd/trunk/server/mpm/winnt/mpm_winnt.c Modified: httpd/httpd/trunk/server/mpm/winnt/mpm_winnt.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/winnt/mpm_winnt.c?rev=609354&r1=609353&r2=609354&view=diff ============================================================================== --- httpd/httpd/trunk/server/mpm/winnt/mpm_winnt.c (original) +++ httpd/httpd/trunk/server/mpm/winnt/mpm_winnt.c Sun Jan 6 09:35:03 2008 @@ -1372,6 +1372,24 @@ service_name); exit(APEXIT_INIT); } + else if (!one_process) { + /* Open a null handle to soak stdout in this process. + * We need to emulate apr_proc_detach, unix performs this + * same check in the pre_config hook (although it is + * arguably premature). Services already fixed this. + */ + apr_file_t *nullfile; + + if ((rv = apr_file_open(&nullfile, "NUL", + APR_READ | APR_WRITE, APR_OS_DEFAULT, + process->pool)) == APR_SUCCESS) { + apr_file_t *nullstdout; + if (apr_file_open_stdout(&nullstdout, process->pool) + == APR_SUCCESS) + apr_file_dup2(nullstdout, nullfile, process->pool); + apr_file_close(nullfile); + } + } /* Win9x: disable AcceptEx */ if (osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {