diff options
Diffstat (limited to 'threadproc')
-rw-r--r-- | threadproc/win32/proc.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/threadproc/win32/proc.c b/threadproc/win32/proc.c index 95e4940c1..c0df40184 100644 --- a/threadproc/win32/proc.c +++ b/threadproc/win32/proc.c @@ -916,18 +916,20 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, stderr_reset, stderr_reset); } - /* Close our side of pipes before releasing lock: otherwise they - * could like to other process when apr_proc_create() is used from - * from multiple threads. - */ - if ((attr->child_in) && (attr->child_in != &no_file)) { - apr_file_close(attr->child_in); - } - if ((attr->child_out) && (attr->child_out != &no_file)) { - apr_file_close(attr->child_out); - } - if ((attr->child_err) && (attr->child_err != &no_file)) { - apr_file_close(attr->child_err); + if (rv == APR_SUCCESS) { + /* Close our side of pipes before releasing lock: otherwise they + * could like to other process when apr_proc_create() is used from + * from multiple threads. + */ + if ((attr->child_in) && (attr->child_in != &no_file)) { + apr_file_close(attr->child_in); + } + if ((attr->child_out) && (attr->child_out != &no_file)) { + apr_file_close(attr->child_out); + } + if ((attr->child_err) && (attr->child_err != &no_file)) { + apr_file_close(attr->child_err); + } } /* RELEASE CRITICAL SECTION |