]> granicus.if.org Git - apache/commitdiff
* server/log.c (ap_open_logs): When dup2'ing the error log to stderr,
authorJoe Orton <jorton@apache.org>
Tue, 24 Oct 2006 14:16:01 +0000 (14:16 +0000)
committerJoe Orton <jorton@apache.org>
Tue, 24 Oct 2006 14:16:01 +0000 (14:16 +0000)
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

CHANGES
server/log.c

diff --git a/CHANGES b/CHANGES
index 6679ac01246c02cad44fcdbda5721c15c8898d51..44a73e2807a2ae16e18c910ab8d84a77d056e662 100644 (file)
--- 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 <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
index c027f002415f67150fc3a1cd3165d2deb8d8c57b..1c8db2099ffda864b6652da87005375c5ebedafe 100644 (file)
@@ -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 {