summaryrefslogtreecommitdiff
path: root/threadproc
diff options
context:
space:
mode:
authorIvan Zhakov <ivan@apache.org>2023-01-21 16:08:49 +0000
committerIvan Zhakov <ivan@apache.org>2023-01-21 16:08:49 +0000
commit545069e7dc77a47168c0667bd7080db008d402de (patch)
treedb19c65f0954148c50850524d352d587ee9e77c4 /threadproc
parentc8b9ea7e8332ee5319f95529e1c64eae5706b05e (diff)
downloadapr-545069e7dc77a47168c0667bd7080db008d402de.tar.gz
Follow-up to r1906885.
* threadproc/win32/proc.c (apr_proc_create): Close redirect pipes only on success to match pre-r1906885 behavior. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1906888 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'threadproc')
-rw-r--r--threadproc/win32/proc.c26
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