You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by st...@apache.org on 2001/07/12 19:30:16 UTC

cvs commit: apr/threadproc/win32 proc.c

stoddard    01/07/12 10:30:16

  Modified:    threadproc/win32 proc.c
  Log:
  Set the DETACHED_PROCESS creation flag
  
  Revision  Changes    Path
  1.46      +13 -6     apr/threadproc/win32/proc.c
  
  Index: proc.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/win32/proc.c,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- proc.c	2001/05/16 05:33:27	1.45
  +++ proc.c	2001/07/12 17:30:14	1.46
  @@ -317,11 +317,11 @@
    */
   
   APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new,
  -                                             const char *progname,
  -                                             const char * const *args,
  -                                             const char * const *env,
  -                                             apr_procattr_t *attr,
  -                                             apr_pool_t *cont)
  +                                          const char *progname,
  +                                          const char * const *args,
  +                                          const char * const *env,
  +                                          apr_procattr_t *attr,
  +                                          apr_pool_t *cont)
   {
       apr_size_t i, iEnvBlockLen;
       char *cmdline;
  @@ -329,6 +329,7 @@
       char *envstr;
       char *pEnvBlock, *pNext;
       PROCESS_INFORMATION pi;
  +    DWORD dwCreationFlags = 0;
   
       new->in = attr->parent_in;
       new->err = attr->parent_err;
  @@ -340,6 +341,7 @@
            * window we are starting in.  And we had better redfine our
            * handles for STDIN, STDOUT, and STDERR.
            */
  +        dwCreationFlags |= DETACHED_PROCESS;
           attr->si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
           attr->si.wShowWindow = SW_HIDE;
   
  @@ -427,7 +429,12 @@
       } 
       
   
  -    if (CreateProcess(NULL, cmdline, NULL, NULL, TRUE, 0, pEnvBlock, attr->currdir, 
  +    if (CreateProcess(NULL, cmdline,     /* Command line */
  +                      NULL, NULL,        /* Proc & thread security attributes */
  +                      TRUE,              /* Inherit handles */
  +                      dwCreationFlags,   /* Creation flags */
  +                      pEnvBlock,         /* Environment block */
  +                      attr->currdir,     /* Current directory name */
                         &attr->si, &pi)) {
   
           // TODO: THIS IS BADNESS
  
  
  

Re: cvs commit: apr/threadproc/win32 proc.c

Posted by Bill Stoddard <bi...@wstoddard.com>.
> From: <st...@apache.org>
> Sent: Thursday, July 12, 2001 12:30 PM
> 
> 
> > stoddard    01/07/12 10:30:16
> > 
> >   Modified:    threadproc/win32 proc.c
> >   Log:
> >   Set the DETACHED_PROCESS creation flag
> 
> >             * window we are starting in.  And we had better redfine our
> >             * handles for STDIN, STDOUT, and STDERR.
> >             */
> >   +        dwCreationFlags |= DETACHED_PROCESS;
> 
> This bit us in the ass on Win9x a while ago.  Essentially, you cannot launch
> any detached 16 bit console process on 9x and trust it's stdin/out/err handles 
> are set appropriately, or closed correctly to tell the parent the child is dead.
> 
> So if these are the apache.exe flags (and even logging or other non-cgi bits), great.
> If they will be used to launch CGI, I'm -1 for this patch unless you test for 
> oslevel >= NT.
> 
I'll check for oslevel >= NT.

Bill


Re: cvs commit: apr/threadproc/win32 proc.c

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
From: <st...@apache.org>
Sent: Thursday, July 12, 2001 12:30 PM


> stoddard    01/07/12 10:30:16
> 
>   Modified:    threadproc/win32 proc.c
>   Log:
>   Set the DETACHED_PROCESS creation flag

>             * window we are starting in.  And we had better redfine our
>             * handles for STDIN, STDOUT, and STDERR.
>             */
>   +        dwCreationFlags |= DETACHED_PROCESS;

This bit us in the ass on Win9x a while ago.  Essentially, you cannot launch
any detached 16 bit console process on 9x and trust it's stdin/out/err handles 
are set appropriately, or closed correctly to tell the parent the child is dead.

So if these are the apache.exe flags (and even logging or other non-cgi bits), great.
If they will be used to launch CGI, I'm -1 for this patch unless you test for 
oslevel >= NT.