You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by "William A. Rowe, Jr." <wr...@rowe-clan.net> on 2007/10/31 03:08:53 UTC

Re: svn commit: r590037 - /apr/apr/trunk/threadproc/os2/proc.c

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.