You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by bj...@apache.org on 2007/10/30 12:18:11 UTC

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

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

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
@@ -130,9 +130,11 @@
                     == APR_SUCCESS)
                 rv = apr_file_inherit_set(attr->child_in);
         }
+    }
 
     if (parent_in != NULL && rv == APR_SUCCESS) {
         rv = apr_file_dup(&attr->parent_in, parent_in, attr->pool);
+    }
 
     return rv;
 }
@@ -161,6 +163,7 @@
   
     if (parent_out != NULL && rv == APR_SUCCESS) {
         rv = apr_file_dup(&attr->parent_out, parent_out, attr->pool);
+    }
 
     return rv;
 }
@@ -189,6 +192,7 @@
   
     if (parent_err != NULL && rv == APR_SUCCESS) {
         rv = apr_file_dup(&attr->parent_err, parent_err, attr->pool);
+    }
 
     return rv;
 }
@@ -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);
     }
     
-    if (attr->child_out) {
-        (attr->child_err->filedes != -1)
-            apr_file_close(attr->child_out);
+    if (attr->child_out && attr->child_err->filedes != -1) {
+        apr_file_close(attr->child_out);
         dup = STDOUT_FILENO;
         DosDupHandle(save_out, &dup);
         DosClose(save_out);
     }
     
-    if (attr->child_err) {
-        (attr->child_err->filedes != -1)
-            apr_file_close(attr->child_err);
+    if (attr->child_err && attr->child_err->filedes != -1) {
+        apr_file_close(attr->child_err);
         dup = STDERR_FILENO;
         DosDupHandle(save_err, &dup);
         DosClose(save_err);



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

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
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.


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

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
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.