diff options
| author | sf <sf@13f79535-47bb-0310-9956-ffa450edef68> | 2011-10-15 20:47:15 +0000 |
|---|---|---|
| committer | sf <sf@13f79535-47bb-0310-9956-ffa450edef68> | 2011-10-15 20:47:15 +0000 |
| commit | fde485dd250d264a940d4330adba4be07760415d (patch) | |
| tree | 9983c686d4674725cd2f540de3e3e7c809261716 | |
| parent | 8dc6d9671081a177b070f7f4af293606bba8ddd5 (diff) | |
| download | libapr-fde485dd250d264a940d4330adba4be07760415d.tar.gz | |
Don't close any of the new stdin/stdout/stderr FDs in the child if it
already has the correct FD.
PR: 51995
Submitted by: Dan Ports <drkp csail mit edu>]
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1183685 13f79535-47bb-0310-9956-ffa450edef68
| -rw-r--r-- | CHANGES | 4 | ||||
| -rw-r--r-- | threadproc/unix/proc.c | 9 |
2 files changed, 10 insertions, 3 deletions
@@ -1,6 +1,10 @@ -*- coding: utf-8 -*- Changes for APR 2.0.0 + *) apr_proc_create: Don't close any of the new stdin/stdout/stderr in the + child if it already has the correct FD. PR 51995. + [Dan Ports <drkp csail mit edu>] + *) apr_thread_pool: Fix thread unsafe pool usage. [Stefan Fritsch] *) apr_brigades: add a check to prevent infinite while loop in case diff --git a/threadproc/unix/proc.c b/threadproc/unix/proc.c index 593eb5ad1..8ded39177 100644 --- a/threadproc/unix/proc.c +++ b/threadproc/unix/proc.c @@ -431,7 +431,8 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, if ((attr->child_in) && (attr->child_in->filedes == -1)) { close(STDIN_FILENO); } - else if (attr->child_in) { + else if (attr->child_in && + attr->child_in->filedes != STDIN_FILENO) { dup2(attr->child_in->filedes, STDIN_FILENO); apr_file_close(attr->child_in); } @@ -439,7 +440,8 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, if ((attr->child_out) && (attr->child_out->filedes == -1)) { close(STDOUT_FILENO); } - else if (attr->child_out) { + else if (attr->child_out && + attr->child_out->filedes != STDOUT_FILENO) { dup2(attr->child_out->filedes, STDOUT_FILENO); apr_file_close(attr->child_out); } @@ -447,7 +449,8 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, if ((attr->child_err) && (attr->child_err->filedes == -1)) { close(STDERR_FILENO); } - else if (attr->child_err) { + else if (attr->child_err && + attr->child_err->filedes != STDERR_FILENO) { dup2(attr->child_err->filedes, STDERR_FILENO); apr_file_close(attr->child_err); } |
