From c8527e9280177c084b600ac19f6cc03a6fc0aaf5 Mon Sep 17 00:00:00 2001 From: Bill Stoddard Date: Wed, 12 Jul 2000 18:40:26 +0000 Subject: [PATCH] Fix a nasty stack corruption. ap_proc_t should be allocated out of the same pool passed to ap_create_process. A little further down the road to getting reliable piped logs working on Win32. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85825 13f79535-47bb-0310-9956-ffa450edef68 --- server/log.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/server/log.c b/server/log.c index 17b9bddc10..fd36776fda 100644 --- a/server/log.c +++ b/server/log.c @@ -173,7 +173,7 @@ static int log_child(ap_pool_t *p, const char *progname, */ int rc = -1; ap_procattr_t *procattr; - ap_proc_t procnew; + ap_proc_t *procnew; #ifdef SIGHUP /* No concept of a child process on Win32 */ @@ -194,11 +194,12 @@ static int log_child(ap_pool_t *p, const char *progname, ap_tokenize_to_argv(progname, &args, p); pname = ap_pstrdup(p, args[0]); - rc = ap_create_process(&procnew, pname, args, NULL, procattr, p); + procnew = (ap_proc_t *) ap_palloc(p, sizeof(*procnew)); + rc = ap_create_process(procnew, pname, args, NULL, procattr, p); if (rc == APR_SUCCESS) { - ap_note_subprocess(p, &procnew, kill_after_timeout); - (*fpin) = procnew.in; + ap_note_subprocess(p, procnew, kill_after_timeout); + (*fpin) = procnew->in; } } @@ -586,7 +587,7 @@ static int piped_log_spawn(piped_log *pl) { int rc; ap_procattr_t *procattr; - ap_proc_t procnew; + ap_proc_t *procnew; ap_status_t status; #ifdef SIGHUP @@ -608,16 +609,16 @@ static int piped_log_spawn(piped_log *pl) ap_tokenize_to_argv(pl->program, &args, pl->p); pname = ap_pstrdup(pl->p, args[0]); - - rc = ap_create_process(&procnew, pname, args, NULL, procattr, pl->p); + procnew = (ap_proc_t *) ap_palloc(p, sizeof(*procnew)); + rc = ap_create_process(procnew, pname, args, NULL, procattr, pl->p); if (rc == APR_SUCCESS) { /* pjr - This no longer happens inside the child, */ /* I am assuming that if ap_create_process was */ /* successful that the child is running. */ RAISE_SIGSTOP(PIPED_LOG_SPAWN); - pl->pid = &procnew; - ap_register_other_child(&procnew, piped_log_maintenance, pl, + pl->pid = procnew; + ap_register_other_child(procnew, piped_log_maintenance, pl, ap_piped_log_write_fd(pl), pl->p); } } -- 2.50.1