]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
One of two gdawful bugs in Apache/Win32, start capturing child errors.
authorWilliam A. Rowe Jr <wrowe@apache.org>
Fri, 21 Dec 2001 00:51:44 +0000 (00:51 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Fri, 21 Dec 2001 00:51:44 +0000 (00:51 +0000)
  The other [significant] error is the tendancy for the parent to restart
  instantly on init errors, which are never corrected.  But that's a patch
  for another day.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@92552 13f79535-47bb-0310-9956-ffa450edef68

src/CHANGES
src/main/http_main.c

index db0d3355de03e9df9d6b436762f9afd25a943530..82c6f0ea9792f588e5a3c1209c8a10c008afd56f 100644 (file)
@@ -1,5 +1,9 @@
 Changes with Apache 1.3.23
 
+  *) Cause Win32 to capture all child-worker process errors in
+     Apache to the main server error log, until the child can
+     open it's own error logs.  [William Rowe]
+
   *) Revert mod_negotation's handling of path_info and query_args
      to the 1.3.20 behavior.  PR: 8628, 8582, 8538  [William Rowe]
 
index b129642ae0f6c00412aed9a3e40766d48f99a953..60d4737b5746df6e845b3747fdb053c0891f6f57 100644 (file)
@@ -6544,7 +6544,7 @@ static int create_process(pool *p, HANDLE *handles, HANDLE *events,
     HANDLE hPipeWrite = NULL;
     HANDLE hPipeWriteDup;
     HANDLE hNullOutput = NULL;
-    HANDLE hNullError = NULL;
+    HANDLE hShareError = NULL;
     HANDLE hCurrentProcess;
     SECURITY_ATTRIBUTES sa = {0};  
 
@@ -6610,14 +6610,12 @@ static int create_process(pool *p, HANDLE *handles, HANDLE *events,
         return -1;
     }
 
-    /* Open a null handle to soak info from the child */
-    hNullError = CreateFile("nul", GENERIC_READ | GENERIC_WRITE, 
-                            FILE_SHARE_READ | FILE_SHARE_WRITE, 
-                            &sa, OPEN_EXISTING, 0, NULL);
-    if (hNullError == INVALID_HANDLE_VALUE) {
-        ap_log_error(APLOG_MARK, APLOG_WIN32ERROR | APLOG_CRIT, server_conf,
-                     "Parent: Unable to create null error pipe for child process.\n");
-        return -1;
+    /* Child's initial stderr -> our main server error log (or, failing that, stderr) */
+    if (server_conf->error_log) {
+        hShareError = (HANDLE)_get_osfhandle(fileno(server_conf->error_log));
+        if (hShareError == INVALID_HANDLE_VALUE) {
+            hShareError = GetStdHandle(STD_ERROR_HANDLE);
+        }
     }
 
     hCurrentProcess = GetCurrentProcess();
@@ -6638,7 +6636,7 @@ static int create_process(pool *p, HANDLE *handles, HANDLE *events,
     si.wShowWindow = SW_HIDE;
     si.hStdInput   = hPipeRead;
     si.hStdOutput  = hNullOutput;
-    si.hStdError   = hNullError;
+    si.hStdError   = hShareError;
 
     if (!CreateProcess(NULL, pCommand, NULL, NULL, 
                        TRUE,      /* Inherit handles */
@@ -6656,7 +6654,6 @@ static int create_process(pool *p, HANDLE *handles, HANDLE *events,
         CloseHandle(hPipeRead);
         CloseHandle(hPipeWrite);        
         CloseHandle(hNullOutput);
-        CloseHandle(hNullError);        
 
         return -1;
     }
@@ -6704,7 +6701,6 @@ static int create_process(pool *p, HANDLE *handles, HANDLE *events,
     CloseHandle(hPipeRead);
     CloseHandle(hPipeWrite);        
     CloseHandle(hNullOutput);
-    CloseHandle(hNullError);        
 
     return 0;
 }