httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r609354 - /httpd/httpd/trunk/server/mpm/winnt/mpm_winnt.c
Date Sun, 06 Jan 2008 17:35:11 GMT
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) {



Mime
View raw message