Commit f4105873 authored by Joe Orton's avatar Joe Orton
Browse files

* server/log.c (ap_open_logs): When dup2'ing the error log to stderr,

use the already-open stderr file object rather than opening a new one.

Submitted by: Tom Donovan <Tom.Donovan acm.org>
PR: 40476


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@467338 13f79535-47bb-0310-9956-ffa450edef68
parent 05fe8b3e
Loading
Loading
Loading
Loading
+3 −0
Changes for CHANGES: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -2,6 +2,9 @@
Changes with Apache 2.3.0
  [Remove entries to the current 2.0 and 2.2 section below, when backported]
  *) Fix issue which could cause error messages to be written to access logs
     on Win32.  PR 40476.  [Tom Donovan <Tom.Donovan acm.org>]
  *) The LockFile directive, which specifies the location of
     the accept() mutex lockfile, is depreciated. Instead, the
     AcceptMutex directive now takes an optional lockfile
+6 −8
Changes for server/log.c: 6 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -354,10 +354,8 @@ static int open_error_log(server_rec *s, int is_main, apr_pool_t *p)
int ap_open_logs(apr_pool_t *pconf, apr_pool_t *p /* plog */,
                 apr_pool_t *ptemp, server_rec *s_main)
{
    apr_status_t rc = APR_SUCCESS;
    server_rec *virt, *q;
    int replace_stderr;
    apr_file_t *errfile = NULL;

    apr_pool_cleanup_register(p, NULL, clear_handle_list,
                              apr_pool_cleanup_null);
@@ -367,13 +365,13 @@ int ap_open_logs(apr_pool_t *pconf, apr_pool_t *p /* plog */,

    replace_stderr = 1;
    if (s_main->error_log) {
        /* replace stderr with this new log */
        apr_status_t rv;
        
        /* Replace existing stderr with new log. */
        apr_file_flush(s_main->error_log);
        if ((rc = apr_file_open_stderr(&errfile, p)) == APR_SUCCESS) {
            rc = apr_file_dup2(errfile, s_main->error_log, p);
        }
        if (rc != APR_SUCCESS) {
            ap_log_error(APLOG_MARK, APLOG_CRIT, rc, s_main,
        rv = apr_file_dup2(stderr_log, s_main->error_log, p);
        if (rv != APR_SUCCESS) {
            ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s_main,
                         "unable to replace stderr with error_log");
        }
        else {