From: Jeff Trawick Date: Sat, 29 Jul 2000 03:08:13 +0000 (+0000) Subject: Change the storage allocation mechanism for ap_proc_t structures X-Git-Tag: APACHE_2_0_ALPHA_5~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=844bc85ee4d6c1c74a9830d2914b219d4fcf116f;p=thirdparty%2Fapache%2Fhttpd.git Change the storage allocation mechanism for ap_proc_t structures passed to ap_note_subprocess() by mod_rewrite and mod_include. The storage needs to last as long as the pool passed to ap_note_subprocess(), so autodata won't work. The mod_rewrite change wasn't tested. A normal build with mod_rewrite on Linux currently results in the link failing due to unresolved references to dbm_*. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85928 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/filters/mod_include.c b/modules/filters/mod_include.c index 7de80555161..1482f1dff2a 100644 --- a/modules/filters/mod_include.c +++ b/modules/filters/mod_include.c @@ -831,7 +831,7 @@ static int include_cmd(char *s, request_rec *r) include_cmd_arg arg; BUFF *script_in; ap_procattr_t *procattr; - ap_proc_t procnew; + ap_proc_t *procnew; ap_status_t rc; ap_table_t *env = r->subprocess_env; char **argv; @@ -896,7 +896,8 @@ static int include_cmd(char *s, request_rec *r) else { build_argv_list(&argv, r, r->pool); argv[0] = ap_pstrdup(r->pool, s); - rc = ap_create_process(&procnew, s, argv, ap_create_environment(r->pool, env), procattr, r->pool); + procnew = ap_pcalloc(r->pool, sizeof(*procnew)); + rc = ap_create_process(procnew, s, argv, ap_create_environment(r->pool, env), procattr, r->pool); if (rc != APR_SUCCESS) { /* Bad things happened. Everyone should have cleaned up. */ @@ -904,9 +905,9 @@ static int include_cmd(char *s, request_rec *r) "couldn't create child process: %d: %s", rc, s); } else { - ap_note_subprocess(r->pool, &procnew, kill_after_timeout); + ap_note_subprocess(r->pool, procnew, kill_after_timeout); /* Fill in BUFF structure for parents pipe to child's stdout */ - file = procnew.out; + file = procnew->out; iol = ap_create_file_iol(file); if (!iol) return APR_EBADF; diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index 88ae72d2dd2..e295df7aa28 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -3421,7 +3421,7 @@ static int rewritemap_program_child(ap_pool_t *p, char *progname, { int rc = -1; ap_procattr_t *procattr; - ap_proc_t procnew; + ap_proc_t *procnew; #ifdef SIGHUP ap_signal(SIGHUP, SIG_IGN); @@ -3439,21 +3439,22 @@ static int rewritemap_program_child(ap_pool_t *p, char *progname, rc = -1; } else { - rc = ap_create_process(&procnew, progname, NULL, NULL, procattr, p); + procnew = ap_pcalloc(p, sizeof(*procnew)); + rc = ap_create_process(procnew, progname, NULL, NULL, procattr, p); if (rc == APR_SUCCESS) { - ap_note_subprocess(p, &procnew, kill_after_timeout); + ap_note_subprocess(p, procnew, kill_after_timeout); if (fpin) { - (*fpin) = procnew.in; + (*fpin) = procnew->in; } if (fpout) { - (*fpout) = procnew.out; + (*fpout) = procnew->out; } if (fperr) { - (*fperr) = procnew.err; + (*fperr) = procnew->err; } } }