View | Details | Raw Unified | Return to bug 40651
Collapse All | Expand All

(-)server/log.c (-4 / +16 lines)
Lines 226-232 Link Here
226
}
226
}
227
227
228
static int log_child(apr_pool_t *p, const char *progname,
228
static int log_child(apr_pool_t *p, const char *progname,
229
                     apr_file_t **fpin)
229
                     apr_file_t **fpin, int dummy_stderr)
230
{
230
{
231
    /* Child process code for 'ErrorLog "|..."';
231
    /* Child process code for 'ErrorLog "|..."';
232
     * may want a common framework for this, since I expect it will
232
     * may want a common framework for this, since I expect it will
Lines 235-240 Link Here
235
    apr_status_t rc;
235
    apr_status_t rc;
236
    apr_procattr_t *procattr;
236
    apr_procattr_t *procattr;
237
    apr_proc_t *procnew;
237
    apr_proc_t *procnew;
238
    apr_file_t *std_out;
238
239
239
    if (((rc = apr_procattr_create(&procattr, p)) == APR_SUCCESS)
240
    if (((rc = apr_procattr_create(&procattr, p)) == APR_SUCCESS)
240
        && ((rc = apr_procattr_cmdtype_set(procattr,
241
        && ((rc = apr_procattr_cmdtype_set(procattr,
Lines 244-250 Link Here
244
                                      APR_NO_PIPE,
245
                                      APR_NO_PIPE,
245
                                      APR_NO_PIPE)) == APR_SUCCESS)
246
                                      APR_NO_PIPE)) == APR_SUCCESS)
246
        && ((rc = apr_procattr_error_check_set(procattr, 1)) == APR_SUCCESS)
247
        && ((rc = apr_procattr_error_check_set(procattr, 1)) == APR_SUCCESS)
247
        && ((rc = apr_procattr_child_errfn_set(procattr, log_child_errfn)) == APR_SUCCESS)) {
248
        && ((rc = apr_procattr_child_errfn_set(procattr, log_child_errfn)) == APR_SUCCESS)
249
        && (dummy_stderr ? ((rc = apr_file_open_stdout(&std_out,
250
                                               p)) == APR_SUCCESS) : 1)
251
        && (dummy_stderr ? ((rc = apr_procattr_child_err_set(procattr,
252
                                                             std_out,
253
                                                             std_out)) == APR_SUCCESS) : 1)) {
248
        char **args;
254
        char **args;
249
        const char *pname;
255
        const char *pname;
250
256
Lines 261-266 Link Here
261
             * close_handle_in_child()
267
             * close_handle_in_child()
262
             */
268
             */
263
        }
269
        }
270
        /*
271
         * Close parent side of dummy stderr file descriptor for child
272
         * to avoid a leak
273
         */
274
        if (dummy_stderr)
275
            apr_file_close(procnew->err);
264
    }
276
    }
265
277
266
    return rc;
278
    return rc;
Lines 275-281 Link Here
275
        apr_file_t *dummy = NULL;
287
        apr_file_t *dummy = NULL;
276
288
277
        /* This starts a new process... */
289
        /* This starts a new process... */
278
        rc = log_child (p, s->error_fname + 1, &dummy);
290
        rc = log_child (p, s->error_fname + 1, &dummy, 1);
279
        if (rc != APR_SUCCESS) {
291
        if (rc != APR_SUCCESS) {
280
            ap_log_error(APLOG_MARK, APLOG_STARTUP, rc, NULL,
292
            ap_log_error(APLOG_MARK, APLOG_STARTUP, rc, NULL,
281
                         "Couldn't start ErrorLog process");
293
                         "Couldn't start ErrorLog process");
Lines 955-961 Link Here
955
    apr_file_t *dummy = NULL;
967
    apr_file_t *dummy = NULL;
956
    int rc;
968
    int rc;
957
969
958
    rc = log_child(p, program, &dummy);
970
    rc = log_child(p, program, &dummy, 0);
959
    if (rc != APR_SUCCESS) {
971
    if (rc != APR_SUCCESS) {
960
        ap_log_error(APLOG_MARK, APLOG_STARTUP, rc, NULL,
972
        ap_log_error(APLOG_MARK, APLOG_STARTUP, rc, NULL,
961
                     "Couldn't start piped log process");
973
                     "Couldn't start piped log process");

Return to bug 40651