From: Joe Orton Date: Tue, 24 Oct 2006 14:16:01 +0000 (+0000) Subject: * server/log.c (ap_open_logs): When dup2'ing the error log to stderr, X-Git-Tag: 2.3.0~2049 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=acd492152e42505459e27e96315364177dd80752;p=apache * 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 PR: 40476 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@467338 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 6679ac0124..44a73e2807 100644 --- a/CHANGES +++ b/CHANGES @@ -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 ] + *) The LockFile directive, which specifies the location of the accept() mutex lockfile, is depreciated. Instead, the AcceptMutex directive now takes an optional lockfile diff --git a/server/log.c b/server/log.c index c027f00241..1c8db2099f 100644 --- a/server/log.c +++ b/server/log.c @@ -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 {