]> granicus.if.org Git - apache/commitdiff
Fix a nasty stack corruption. ap_proc_t should be allocated out of the same
authorBill Stoddard <stoddard@apache.org>
Wed, 12 Jul 2000 18:40:26 +0000 (18:40 +0000)
committerBill Stoddard <stoddard@apache.org>
Wed, 12 Jul 2000 18:40:26 +0000 (18:40 +0000)
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

index 17b9bddc107756d335aed05c1ccd413974a9618a..fd36776fda9b4e865ccb29fea97d7f250699b657 100644 (file)
@@ -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);
         }
     }