summaryrefslogtreecommitdiff
path: root/threadproc
diff options
context:
space:
mode:
authorwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2002-07-18 19:27:38 +0000
committerwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2002-07-18 19:27:38 +0000
commit2ac7c6d37890a2a2ba6a2c5c116cd6a3b8aa5846 (patch)
tree755fe32afa82a3271765a93fae44a3af904376e0 /threadproc
parentea8cdebd6e7ffa0d0aa425c02a508864d0ce391c (diff)
downloadlibapr-2ac7c6d37890a2a2ba6a2c5c116cd6a3b8aa5846.tar.gz
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. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@63707 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'threadproc')
-rw-r--r--threadproc/win32/proc.c42
1 files changed, 27 insertions, 15 deletions
diff --git a/threadproc/win32/proc.c b/threadproc/win32/proc.c
index e3b6ef284..1c4dd5685 100644
--- a/threadproc/win32/proc.c
+++ b/threadproc/win32/proc.c
@@ -590,26 +590,30 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new,
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 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new,
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 */