From: William A. Rowe Jr Date: Fri, 21 Dec 2001 00:51:44 +0000 (+0000) Subject: One of two gdawful bugs in Apache/Win32, start capturing child errors. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a6af5d1be04edfc1456fa586797447ec2f2e58b3;p=thirdparty%2Fapache%2Fhttpd.git One of two gdawful bugs in Apache/Win32, start capturing child errors. 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 --- diff --git a/src/CHANGES b/src/CHANGES index db0d3355de0..82c6f0ea979 100644 --- a/src/CHANGES +++ b/src/CHANGES @@ -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] diff --git a/src/main/http_main.c b/src/main/http_main.c index b129642ae0f..60d4737b574 100644 --- a/src/main/http_main.c +++ b/src/main/http_main.c @@ -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; }