]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
log core: fix the new piped logger case where we couldn't connect
authorWilliam A. Rowe Jr <wrowe@apache.org>
Fri, 24 Aug 2007 22:05:55 +0000 (22:05 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Fri, 24 Aug 2007 22:05:55 +0000 (22:05 +0000)
the replacement stderr logger's stderr to the NULL stdout stream.
Continue in this case, since the previous alternative of no error
logging at all (/dev/null) is far worse. [William Rowe]

also disambiguate an error message to diagnose future error reports

Backport: r568326, r568322

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

CHANGES
STATUS
server/log.c

diff --git a/CHANGES b/CHANGES
index b98127da05650bd21bcf6b63adcc95ab27080327..1194b5f6f344095d05a30a469bfeebe4a0c2f4c4 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,11 @@
                                                         -*- coding: utf-8 -*-
 Changes with Apache 2.2.6
 
+  *) log core: fix the new piped logger case where we couldn't connect 
+     the replacement stderr logger's stderr to the NULL stdout stream.  
+     Continue in this case, since the previous alternative of no error 
+     logging at all (/dev/null) is far worse. [William Rowe]
+
   *) mpm_winnt: Prevent the parent-child pipe from leaking into other
      spawned processes, and ensure we have a /Device/null handle for
      stdout when running as-a-service.  [William Rowe]
diff --git a/STATUS b/STATUS
index 7bfa76c8edf999aa9c13fb1c3b8f4007a55ca2c0..dd413334ace0db3830c1bf1c3b8d4be12b023bb0 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -290,17 +290,6 @@ PATCHES PROPOSED TO BACKPORT FROM TRUNK:
       http://svn.apache.org/viewvc?view=rev&revision=565671
       +1: niq
  
-    * log core: fix the new piped logger case where we couldn't connect 
-      the replacement stderr logger's stderr to the NULL stdout stream.  
-      Continue in this case, since the previous alternative of no error 
-      logging at all (/dev/null) is far worse. [William Rowe]
-        http://svn.apache.org/viewvc?view=rev&revision=568326
-      disambiguate an error message to diagnose future error reports
-        http://svn.apache.org/viewvc?view=rev&revision=568322
-        +1: wrowe
-            rpluem says: +1 once r568446 is backported.
-            jim: Agrees with rpluem.
-
     * main core: Emit errors during the initial apr_app_initialize()
       or apr_pool_create() (when apr-based error reporting is not ready).
         http://svn.apache.org/viewvc?view=rev&revision=568779
index c027f002415f67150fc3a1cd3165d2deb8d8c57b..43661591d6d00201beccd936aa31d7353c50ca19 100644 (file)
@@ -213,7 +213,7 @@ AP_DECLARE(apr_status_t) ap_replace_stderr_log(apr_pool_t *p,
     }
     if (rc != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_CRIT, rc, NULL,
-                     "unable to replace stderr with error_log");
+                     "unable to replace stderr with error log file");
     }
     return rc;
 }
@@ -250,18 +250,20 @@ static int log_child(apr_pool_t *p, const char *progname,
                                       APR_NO_PIPE,
                                       APR_NO_PIPE)) == APR_SUCCESS)
         && ((rc = apr_procattr_error_check_set(procattr, 1)) == APR_SUCCESS)
-        && ((rc = apr_procattr_child_errfn_set(procattr, log_child_errfn)) == APR_SUCCESS)
-        && (!dummy_stderr 
-            || ((rc = apr_file_open_stdout(&errfile, p)) == APR_SUCCESS
-                && (rc = apr_procattr_child_err_set(procattr, 
-                                                    errfile, 
-                                                    errfile)) == APR_SUCCESS))) {
+        && ((rc = apr_procattr_child_errfn_set(procattr, log_child_errfn)) 
+                == APR_SUCCESS)) {
         char **args;
         const char *pname;
 
         apr_tokenize_to_argv(progname, &args, p);
         pname = apr_pstrdup(p, args[0]);
         procnew = (apr_proc_t *)apr_pcalloc(p, sizeof(*procnew));
+
+        if (dummy_stderr) {
+            if ((rc = apr_file_open_stdout(&errfile, p)) == APR_SUCCESS)
+                rc = apr_procattr_child_err_set(procattr, errfile, NULL);
+        }
+
         rc = apr_proc_create(procnew, pname, (const char * const *)args,
                              NULL, procattr, p);
 
@@ -272,13 +274,6 @@ static int log_child(apr_pool_t *p, const char *progname,
              * close_handle_in_child()
              */
         }
-
-        /* apr_procattr_child_err_set dups errfile twice: close the
-         * remaining "parent-side" copy (apr_proc_create closes the
-         * other). */
-        if (dummy_stderr) {
-            apr_file_close(procnew->err);
-        }
     }
 
     return rc;