From: William A. Rowe Jr Date: Mon, 31 Mar 2003 04:44:11 +0000 (+0000) Subject: Solve segfaults from unusual error exceptions in cgid. The daemon X-Git-Tag: pre_ajp_proxy~1945 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=686f8cf5aedd1a5a9dcce31d3e5ec5e786e5db4b;p=thirdparty%2Fapache%2Fhttpd.git Solve segfaults from unusual error exceptions in cgid. The daemon has no 'real' request_rec, so we can't use ap_log_rerror() anywhere within the cgid_server() code. Also, one of the two log messages was echoed to the child, no point when the actual request logic should take care of that notification. Submitted by: Jeff Trawick Reviewed by: Bill Rowe git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@99132 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/generators/mod_cgid.c b/modules/generators/mod_cgid.c index 4ce4ec70199..d0b9b05f15a 100644 --- a/modules/generators/mod_cgid.c +++ b/modules/generators/mod_cgid.c @@ -735,8 +735,11 @@ static int cgid_server(void *data) ((rc = apr_procattr_cmdtype_set(procattr, cmd_type)) != APR_SUCCESS) || ((rc = apr_procattr_child_errfn_set(procattr, cgid_child_errfn)) != APR_SUCCESS)) { /* Something bad happened, tell the world. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r, - "couldn't set child process attributes: %s", r->filename); + * ap_log_rerror() won't work because the header table used by + * ap_log_rerror() hasn't been replicated in the phony r + */ + ap_log_error(APLOG_MARK, APLOG_ERR, rc, r->server, + "couldn't set child process attributes: %s", r->filename); } else { apr_pool_userdata_set(r, ERRFN_USERDATA_KEY, apr_pool_cleanup_null, ptrans); @@ -757,10 +760,13 @@ static int cgid_server(void *data) procattr, ptrans); if (rc != APR_SUCCESS) { - /* Bad things happened. Everyone should have cleaned up. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_TOCLIENT, rc, r, - "couldn't create child process: %d: %s", rc, - apr_filename_of_pathname(r->filename)); + /* Bad things happened. Everyone should have cleaned up. + * ap_log_rerror() won't work because the header table used by + * ap_log_rerror() hasn't been replicated in the phony r + */ + ap_log_error(APLOG_MARK, APLOG_ERR, rc, r->server, + "couldn't create child process: %d: %s", rc, + apr_filename_of_pathname(r->filename)); } else { apr_hash_set(script_hash, &cgid_req.conn_id, sizeof(cgid_req.conn_id),