wrowe 2002/07/18 12:27:38
Modified: threadproc/win32 proc.c
Log:
Correct Rob's recent patch to handle both NT and 9x, and skip wasting
these cycles if we aren't toggling USESTDHANDLES or have a handle to
fill-in-the-blanks.
Revision Changes Path
1.82 +27 -15 apr/threadproc/win32/proc.c
Index: proc.c
===================================================================
RCS file: /home/cvs/apr/threadproc/win32/proc.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -r1.81 -r1.82
--- proc.c 18 Jul 2002 12:58:54 -0000 1.81
+++ proc.c 18 Jul 2002 19:27:38 -0000 1.82
@@ -590,26 +590,30 @@
memset(&si, 0, sizeof(si));
si.cb = sizeof(si);
- si.hStdInput = INVALID_HANDLE_VALUE;
- si.hStdOutput = INVALID_HANDLE_VALUE;
- si.hStdError = INVALID_HANDLE_VALUE;
if (attr->detached) {
si.dwFlags |= STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;
}
+
#ifndef _WIN32_WCE
if ((attr->child_in && attr->child_in->filehand)
|| (attr->child_out && attr->child_out->filehand)
|| (attr->child_err && attr->child_err->filehand))
{
si.dwFlags |= STARTF_USESTDHANDLES;
- if (attr->child_in)
- si.hStdInput = attr->child_in->filehand;
- if (attr->child_out)
- si.hStdOutput = attr->child_out->filehand;
- if (attr->child_err)
- si.hStdError = attr->child_err->filehand;
+
+ si.hStdInput = (attr->child_in)
+ ? attr->child_in->filehand
+ : INVALID_HANDLE_VALUE;
+
+ si.hStdOutput = (attr->child_out)
+ ? attr->child_out->filehand
+ : INVALID_HANDLE_VALUE;
+
+ si.hStdError = (attr->child_err)
+ ? attr->child_err->filehand
+ : INVALID_HANDLE_VALUE;
}
rv = CreateProcessW(wprg, wcmd, /* Executable & Command line
*/
NULL, NULL, /* Proc & thread security
attributes */
@@ -636,21 +640,29 @@
STARTUPINFOA si;
memset(&si, 0, sizeof(si));
si.cb = sizeof(si);
+
if (attr->detached) {
si.dwFlags |= STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;
}
+
if ((attr->child_in && attr->child_in->filehand)
|| (attr->child_out && attr->child_out->filehand)
|| (attr->child_err && attr->child_err->filehand))
{
si.dwFlags |= STARTF_USESTDHANDLES;
- if (attr->child_in)
- si.hStdInput = attr->child_in->filehand;
- if (attr->child_out)
- si.hStdOutput = attr->child_out->filehand;
- if (attr->child_err)
- si.hStdError = attr->child_err->filehand;
+
+ si.hStdInput = (attr->child_in)
+ ? attr->child_in->filehand
+ : INVALID_HANDLE_VALUE;
+
+ si.hStdOutput = (attr->child_out)
+ ? attr->child_out->filehand
+ : INVALID_HANDLE_VALUE;
+
+ si.hStdError = (attr->child_err)
+ ? attr->child_err->filehand
+ : INVALID_HANDLE_VALUE;
}
rv = CreateProcessA(progname, cmdline, /* Command line */