From c43e6c5a24ac1693fd463584ca42f25c4b8cc3e3 Mon Sep 17 00:00:00 2001 From: "William A. Rowe Jr" Date: Tue, 21 Aug 2007 23:28:32 +0000 Subject: [PATCH] Refactor r452431, because this should not be fatal to starting 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 | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/server/log.c b/server/log.c index 8a85a34bd1..d43da51d73 100644 --- a/server/log.c +++ b/server/log.c @@ -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; -- 2.40.0