You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by st...@locus.apache.org on 2000/07/12 20:40:30 UTC

cvs commit: apache-2.0/src/main http_log.c

stoddard    00/07/12 11:40:28

  Modified:    src/main http_log.c
  Log:
  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.
  
  Revision  Changes    Path
  1.59      +10 -9     apache-2.0/src/main/http_log.c
  
  Index: http_log.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_log.c,v
  retrieving revision 1.58
  retrieving revision 1.59
  diff -u -r1.58 -r1.59
  --- http_log.c	2000/06/28 14:33:32	1.58
  +++ http_log.c	2000/07/12 18:40:26	1.59
  @@ -173,7 +173,7 @@
        */
       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 @@
           
           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 @@
   {
       int rc;
       ap_procattr_t *procattr;
  -    ap_proc_t procnew;
  +    ap_proc_t *procnew;
       ap_status_t status;
   
   #ifdef SIGHUP
  @@ -608,16 +609,16 @@
   
           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);
           }
       }
  
  
  

Re: cvs commit: apache-2.0/src/main http_log.c

Posted by rb...@covalent.net.
Because ap_proc_t isn't an incomplete type.  I believe at one point
create_process did allocate the space for us, but when we changed the type
to be complete, that was no longer necessary, and it made the code harder
to deal with.  This is the same way all of the other APR complete types
work.

Ryan

On Wed, 12 Jul 2000, Greg Stein wrote:

> On Wed, Jul 12, 2000 at 06:40:30PM -0000, stoddard@locus.apache.org wrote:
> > stoddard    00/07/12 11:40:28
> > 
> >   Modified:    src/main http_log.c
> >   Log:
> >   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.
> 
> Why doesn't ap_create_process() allocate and return one? (like most other
> APR functions)
> 
> Cheers,
> -g
> 
> -- 
> Greg Stein, http://www.lyra.org/
> 


_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Re: cvs commit: apache-2.0/src/main http_log.c

Posted by Greg Stein <gs...@lyra.org>.
On Wed, Jul 12, 2000 at 06:40:30PM -0000, stoddard@locus.apache.org wrote:
> stoddard    00/07/12 11:40:28
> 
>   Modified:    src/main http_log.c
>   Log:
>   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.

Why doesn't ap_create_process() allocate and return one? (like most other
APR functions)

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/