summaryrefslogtreecommitdiff
path: root/threadproc
diff options
context:
space:
mode:
authorbjh <bjh@13f79535-47bb-0310-9956-ffa450edef68>2007-10-31 22:06:10 +0000
committerbjh <bjh@13f79535-47bb-0310-9956-ffa450edef68>2007-10-31 22:06:10 +0000
commit3adfda17ce942c24437eb06d790b0f4fc3105f31 (patch)
tree8725ae50087b25a4a767fbf2551a0e2fa54b35de /threadproc
parentbaeb7d94eea0f02c5ed5a790ee960db449b3860d (diff)
downloadlibapr-3adfda17ce942c24437eb06d790b0f4fc3105f31.tar.gz
OS/2: Fix condition for restoring std handles after spawning a process.
We still need to restore the std handles if "no file" (filedes == -1) is passed to the child. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@590848 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'threadproc')
-rw-r--r--threadproc/os2/proc.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/threadproc/os2/proc.c b/threadproc/os2/proc.c
index d05666dec..059558a90 100644
--- a/threadproc/os2/proc.c
+++ b/threadproc/os2/proc.c
@@ -503,22 +503,31 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname
chdir(savedir);
}
- if (attr->child_in && (attr->child_in->filedes != -1)) {
- apr_file_close(attr->child_in);
+ if (attr->child_in) {
+ if (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) {
+ if (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) {
+ if (attr->child_err->filedes != -1) {
+ apr_file_close(attr->child_err);
+ }
+
dup = STDERR_FILENO;
DosDupHandle(save_err, &dup);
DosClose(save_err);