summaryrefslogtreecommitdiff
path: root/threadproc
diff options
context:
space:
mode:
authorBrian Havard <bjh@apache.org>2007-10-31 22:06:10 +0000
committerBrian Havard <bjh@apache.org>2007-10-31 22:06:10 +0000
commit1685acccfbc9f7f35587345dfe098e3579c94ea1 (patch)
tree8725ae50087b25a4a767fbf2551a0e2fa54b35de /threadproc
parente13cb5187880f2adcc385c3813f706d52e9d4096 (diff)
downloadapr-1685acccfbc9f7f35587345dfe098e3579c94ea1.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: https://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);