apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r582057 - in /apr/apr/branches/0.9.x: CHANGES include/apr_thread_proc.h threadproc/win32/proc.c
Date Fri, 05 Oct 2007 02:11:22 GMT
Author: wrowe
Date: Thu Oct  4 19:11:21 2007
New Revision: 582057

URL: http://svn.apache.org/viewvc?rev=582057&view=rev
Log:
Revert to 0.9.14 behavior; only sane recourse if this
behavior fix is deferred to 1.3.0 release.

Modified:
    apr/apr/branches/0.9.x/CHANGES
    apr/apr/branches/0.9.x/include/apr_thread_proc.h
    apr/apr/branches/0.9.x/threadproc/win32/proc.c

Modified: apr/apr/branches/0.9.x/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/branches/0.9.x/CHANGES?rev=582057&r1=582056&r2=582057&view=diff
==============================================================================
--- apr/apr/branches/0.9.x/CHANGES [utf-8] (original)
+++ apr/apr/branches/0.9.x/CHANGES [utf-8] Thu Oct  4 19:11:21 2007
@@ -4,16 +4,15 @@
   *) Cause apr_file_dup2() on Win32 to update the MSVCRT psuedo-stdio
      handles for fd-based and FILE * based I/O.  [William Rowe]
 
-  *) Introduce APR_NO_FILE as an option to apr_procattr_io_set() for any 
-     of the three stdio streams to cause the corresponding streams to NOT
-     be inherited to a WIN32 child process (passes INVALID_HANDLE_VALUE).
-     This is of little importance to most developers, except those who had
-     exploited an inconsistency between Unix and Win32 that was corrected
-     on Win32 with APR version 0.9.16.  The feature to have NO_FILE work
-     across platforms and leave a specified std stream closed becomes 
-     portable in APR version 1.3.0 (it remains equivilant to APR_NO_PIPE 
-     on non-Windows platforms throughout APR versions 0.9.x and 1.2.x).
-     [William Rowe]
+  *) Revert Win32 to the 0.9.14 behavior of apr_proc_create() for any 
+     of the three stdio streams which are not initialized, through either
+     apr_procattr_io_set() or apr_procattr_stdXXX_set(), when given a
+     procattr_t with one or two streams which were initialized through
+     apr_procattr_stdXXX_set().  Once again, these do not inherit the 
+     parent process stdio stream to WIN32 child processes (passing 
+     INVALID_HANDLE_VALUE instead) as on Unix.  Note APR 1.3.0 adopts 
+     the unix behavior of inheriting any uninitialed streams as the 
+     parent's corresponding stdio stream, in such cases.  [William Rowe]
 
 Changes with APR 0.9.16
 

Modified: apr/apr/branches/0.9.x/include/apr_thread_proc.h
URL: http://svn.apache.org/viewvc/apr/apr/branches/0.9.x/include/apr_thread_proc.h?rev=582057&r1=582056&r2=582057&view=diff
==============================================================================
--- apr/apr/branches/0.9.x/include/apr_thread_proc.h (original)
+++ apr/apr/branches/0.9.x/include/apr_thread_proc.h Thu Oct  4 19:11:21 2007
@@ -87,15 +87,6 @@
 /** @see apr_procattr_io_set */
 #define APR_CHILD_BLOCK      4
 
-/** @see apr_procattr_io_set 
- * @note introduced strictly for Win32 to apr revision 1.2.12 (to restore
- * the non-portable default behavior of 1.2.9 and prior versions on Win32).
- * This becomes portable to all platforms effective revision 1.3.0, ensuring
- * the standard files specified in the call to apr_procattr_io_set are not
- * open in the created process (on Win32 as INVALID_HANDLE_VALUEs).
- */
-#define APR_NO_FILE          8
-
 /** @see apr_procattr_limit_set */
 #define APR_LIMIT_CPU        0
 /** @see apr_procattr_limit_set */

Modified: apr/apr/branches/0.9.x/threadproc/win32/proc.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/0.9.x/threadproc/win32/proc.c?rev=582057&r1=582056&r2=582057&view=diff
==============================================================================
--- apr/apr/branches/0.9.x/threadproc/win32/proc.c (original)
+++ apr/apr/branches/0.9.x/threadproc/win32/proc.c Thu Oct  4 19:11:21 2007
@@ -32,11 +32,6 @@
 #include <process.h>
 #endif
 
-/* Heavy on no'ops, here's what we want to pass if there is APR_NO_FILE
- * requested for a specific child handle;
- */
-static apr_file_t no_file = { NULL, INVALID_HANDLE_VALUE, };
-
 /* We have very carefully excluded volumes of definitions from the
  * Microsoft Platform SDK, which kill the build time performance.
  * These the sole constants we borrow from WinBase.h and WinUser.h
@@ -93,29 +88,20 @@
         else if (in == APR_PARENT_BLOCK)
             in = APR_WRITE_BLOCK;
 
-        if (in == APR_NO_FILE)
-            attr->child_in = &no_file;
-        else
-            stat = apr_create_nt_pipe(&attr->child_in, &attr->parent_in,
-                                      in, attr->pool);
+        stat = apr_create_nt_pipe(&attr->child_in, &attr->parent_in,
+                                  in, attr->pool);
         if (stat == APR_SUCCESS)
             stat = apr_file_inherit_unset(attr->parent_in);
     }
     if (out && stat == APR_SUCCESS) {
-        if (out == APR_NO_FILE)
-            attr->child_out = &no_file;
-        else
-            stat = apr_create_nt_pipe(&attr->parent_out, &attr->child_out,
-                                      out, attr->pool);
+        stat = apr_create_nt_pipe(&attr->parent_out, &attr->child_out,
+                                  out, attr->pool);
         if (stat == APR_SUCCESS)
             stat = apr_file_inherit_unset(attr->parent_out);
     }
     if (err && stat == APR_SUCCESS) {
-        if (err == APR_NO_FILE)
-            attr->child_err = &no_file;
-        else
-            stat = apr_create_nt_pipe(&attr->parent_err, &attr->child_err,
-                                      err, attr->pool);
+        stat = apr_create_nt_pipe(&attr->parent_err, &attr->child_err,
+                                  err, attr->pool);
         if (stat == APR_SUCCESS)
             stat = apr_file_inherit_unset(attr->parent_err);
     }
@@ -129,7 +115,7 @@
     apr_status_t rv = APR_SUCCESS;
 
     if (child_in) {
-        if ((attr->child_in == NULL) || (attr->child_in == &no_file))
+        if (attr->child_in == NULL)
             rv = apr_file_dup(&attr->child_in, child_in, attr->pool);
         else
             rv = apr_file_dup2(attr->child_in, child_in, attr->pool);
@@ -155,7 +141,7 @@
     apr_status_t rv = APR_SUCCESS;
 
     if (child_out) {
-        if ((attr->child_out == NULL) || (attr->child_out == &no_file))
+        if (attr->child_out == NULL)
             rv = apr_file_dup(&attr->child_out, child_out, attr->pool);
         else
             rv = apr_file_dup2(attr->child_out, child_out, attr->pool);
@@ -181,7 +167,7 @@
     apr_status_t rv = APR_SUCCESS;
 
     if (child_err) {
-        if ((attr->child_err == NULL) || (attr->child_err == &no_file))
+        if (attr->child_err == NULL)
             rv = apr_file_dup(&attr->child_err, child_err, attr->pool);
         else
             rv = apr_file_dup2(attr->child_err, child_err, attr->pool);
@@ -680,49 +666,49 @@
             si.dwFlags |= STARTF_USESTDHANDLES;
 
             si.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
+            if (GetHandleInformation(si.hStdInput, &stdin_reset)
+                    && (stdin_reset &= HANDLE_FLAG_INHERIT))
+                SetHandleInformation(si.hStdInput,
+                                     HANDLE_FLAG_INHERIT, 0);
+
             if (attr->child_in && attr->child_in->filehand)
             {
-                if (GetHandleInformation(si.hStdInput,
-                                         &stdin_reset)
-                        && (stdin_reset &= HANDLE_FLAG_INHERIT))
-                    SetHandleInformation(si.hStdInput,
-                                         HANDLE_FLAG_INHERIT, 0);
-
-                if ( (si.hStdInput = attr->child_in->filehand) 
-                                   != INVALID_HANDLE_VALUE )
-                    SetHandleInformation(si.hStdInput, HANDLE_FLAG_INHERIT,
-                                                       HANDLE_FLAG_INHERIT);
+                si.hStdInput = attr->child_in->filehand;
+                SetHandleInformation(si.hStdInput, HANDLE_FLAG_INHERIT,
+                                                   HANDLE_FLAG_INHERIT);
             }
+            else
+                si.hStdInput = INVALID_HANDLE_VALUE;
             
             si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
+            if (GetHandleInformation(si.hStdOutput, &stdout_reset)
+                    && (stdout_reset &= HANDLE_FLAG_INHERIT))
+                SetHandleInformation(si.hStdOutput,
+                                     HANDLE_FLAG_INHERIT, 0);
+
             if (attr->child_out && attr->child_out->filehand)
             {
-                if (GetHandleInformation(si.hStdOutput,
-                                         &stdout_reset)
-                        && (stdout_reset &= HANDLE_FLAG_INHERIT))
-                    SetHandleInformation(si.hStdOutput,
-                                         HANDLE_FLAG_INHERIT, 0);
-
-                if ( (si.hStdOutput = attr->child_out->filehand) 
-                                   != INVALID_HANDLE_VALUE )
-                    SetHandleInformation(si.hStdOutput, HANDLE_FLAG_INHERIT,
-                                                        HANDLE_FLAG_INHERIT);
+                si.hStdOutput = attr->child_out->filehand;
+                SetHandleInformation(si.hStdOutput, HANDLE_FLAG_INHERIT,
+                                                    HANDLE_FLAG_INHERIT);
             }
+            else
+                si.hStdOutput = INVALID_HANDLE_VALUE;
 
             si.hStdError = GetStdHandle(STD_ERROR_HANDLE);
+            if (GetHandleInformation(si.hStdError, &stderr_reset)
+                    && (stderr_reset &= HANDLE_FLAG_INHERIT))
+                SetHandleInformation(si.hStdError,
+                                     HANDLE_FLAG_INHERIT, 0);
+
             if (attr->child_err && attr->child_err->filehand)
             {
-                if (GetHandleInformation(si.hStdError,
-                                         &stderr_reset)
-                        && (stderr_reset &= HANDLE_FLAG_INHERIT))
-                    SetHandleInformation(si.hStdError,
-                                         HANDLE_FLAG_INHERIT, 0);
-
-                if ( (si.hStdError = attr->child_err->filehand) 
-                                   != INVALID_HANDLE_VALUE )
-                    SetHandleInformation(si.hStdError, HANDLE_FLAG_INHERIT,
-                                                       HANDLE_FLAG_INHERIT);
+                si.hStdError = attr->child_err->filehand;
+                SetHandleInformation(si.hStdError, HANDLE_FLAG_INHERIT,
+                                                   HANDLE_FLAG_INHERIT);
             }
+            else
+                si.hStdError = INVALID_HANDLE_VALUE;
         }
         rv = CreateProcessW(wprg, wcmd,        /* Executable & Command line */
                             NULL, NULL,        /* Proc & thread security attributes */
@@ -816,13 +802,13 @@
     new->hproc = pi.hProcess;
     new->pid = pi.dwProcessId;
 
-    if ((attr->child_in) && (attr->child_in != &no_file)) {
+    if (attr->child_in) {
         apr_file_close(attr->child_in);
     }
-    if ((attr->child_out) && (attr->child_out != &no_file)) {
+    if (attr->child_out) {
         apr_file_close(attr->child_out);
     }
-    if ((attr->child_err) && (attr->child_err != &no_file)) {
+    if (attr->child_err) {
         apr_file_close(attr->child_err);
     }
     CloseHandle(pi.hThread);



Mime
View raw message