Index: server/log.c =================================================================== --- server/log.c (Revision 451290) +++ server/log.c (Arbeitskopie) @@ -226,7 +226,7 @@ } static int log_child(apr_pool_t *p, const char *progname, - apr_file_t **fpin) + apr_file_t **fpin, int dummy_stderr) { /* Child process code for 'ErrorLog "|..."'; * may want a common framework for this, since I expect it will @@ -235,6 +235,7 @@ apr_status_t rc; apr_procattr_t *procattr; apr_proc_t *procnew; + apr_file_t *std_out; if (((rc = apr_procattr_create(&procattr, p)) == APR_SUCCESS) && ((rc = apr_procattr_cmdtype_set(procattr, @@ -244,7 +245,12 @@ 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)) { + && ((rc = apr_procattr_child_errfn_set(procattr, log_child_errfn)) == APR_SUCCESS) + && (dummy_stderr ? ((rc = apr_file_open_stdout(&std_out, + p)) == APR_SUCCESS) : 1) + && (dummy_stderr ? ((rc = apr_procattr_child_err_set(procattr, + std_out, + std_out)) == APR_SUCCESS) : 1)) { char **args; const char *pname; @@ -261,6 +267,12 @@ * close_handle_in_child() */ } + /* + * Close parent side of dummy stderr file descriptor for child + * to avoid a leak + */ + if (dummy_stderr) + apr_file_close(procnew->err); } return rc; @@ -275,7 +287,7 @@ apr_file_t *dummy = NULL; /* This starts a new process... */ - rc = log_child (p, s->error_fname + 1, &dummy); + rc = log_child (p, s->error_fname + 1, &dummy, 1); if (rc != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_STARTUP, rc, NULL, "Couldn't start ErrorLog process"); @@ -955,7 +967,7 @@ apr_file_t *dummy = NULL; int rc; - rc = log_child(p, program, &dummy); + rc = log_child(p, program, &dummy, 0); if (rc != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_STARTUP, rc, NULL, "Couldn't start piped log process");