apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject Re: svn commit: r590037 - /apr/apr/trunk/threadproc/os2/proc.c
Date Wed, 31 Oct 2007 02:08:53 GMT
bjh@apache.org wrote:
> Author: bjh
> Date: Tue Oct 30 04:18:10 2007
> New Revision: 590037
> 
> URL: http://svn.apache.org/viewvc?rev=590037&view=rev
> Log:
> Fix build breakage due to syntax errors in threadproc/os2/proc.c.
> I haven't yet verified that the code works but this is a step in the right 
> direction.
> 
> Modified: apr/apr/trunk/threadproc/os2/proc.c
> URL: http://svn.apache.org/viewvc/apr/apr/trunk/threadproc/os2/proc.c?rev=590037&r1=590036&r2=590037&view=diff
> ==============================================================================
> --- apr/apr/trunk/threadproc/os2/proc.c (original)
> +++ apr/apr/trunk/threadproc/os2/proc.c Tue Oct 30 04:18:10 2007
> @@ -499,25 +503,22 @@
>          chdir(savedir);
>      }
>  
> -    if (attr->child_in) {
> -        (attr->child_in->filedes != -1)
> -            apr_file_close(attr->child_in);
> +    if (attr->child_in && (attr->child_in->filedes != -1)) {
> +        apr_file_close(attr->child_in);
>          dup = STDIN_FILENO;
>          DosDupHandle(save_in, &dup);
>          DosClose(save_in);

Just to be clear here, if filedes is -1, we have "no file" and the structure
is static, and we must avoid apr_file_close as we did both before and after.

The exception case here was to let us dup the std handle earlier in the code
to be inheritable, and then here to close the dup of the standard handle.

In your patch, we now fail to come back to the uninherited stdin/out/err,
which means that another process would inherit that in/out/err handle even
when it's not deliberately transmitted to the child process.

So child_in can be set to filedes -1, meaning "use the standard handle",
and we want to jump back on the original, uninherited handle.


Mime
View raw message