]> granicus.if.org Git - apache/commitdiff
Refactor r452431, because this should not be fatal to starting
authorWilliam A. Rowe Jr <wrowe@apache.org>
Tue, 21 Aug 2007 23:28:32 +0000 (23:28 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Tue, 21 Aug 2007 23:28:32 +0000 (23:28 +0000)
the server if it's horribly broken.  The alternative of returing
'rc' in this case would be to open /dev/null as the error stream
for this generation of the server; and even more useless result.

Also the parent-file was never necessary; we can pass only the
child handle using apr_procattr_child_err_set() and have no extra
file to clean up afterwards.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@568326 13f79535-47bb-0310-9956-ffa450edef68

server/log.c

index 8a85a34bd1046dde502a62d9ec15cebad3511431..d43da51d7361b900ca4b67f38db96db03b07fe50 100644 (file)
@@ -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;