From: William A. Rowe Jr Date: Tue, 21 Aug 2007 23:28:32 +0000 (+0000) Subject: Refactor r452431, because this should not be fatal to starting X-Git-Tag: 2.3.0~1575 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c43e6c5a24ac1693fd463584ca42f25c4b8cc3e3;p=thirdparty%2Fapache%2Fhttpd.git 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 --- diff --git a/server/log.c b/server/log.c index 8a85a34bd10..d43da51d736 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;