summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan@13f79535-47bb-0310-9956-ffa450edef68>2023-01-21 16:08:49 +0000
committerivan <ivan@13f79535-47bb-0310-9956-ffa450edef68>2023-01-21 16:08:49 +0000
commitf4a4ec18a1c723f22250bc2aeb6ca58e54bb265d (patch)
treedb19c65f0954148c50850524d352d587ee9e77c4
parent60fff85c40807a039a7f3a14273b13592a37cbed (diff)
downloadlibapr-f4a4ec18a1c723f22250bc2aeb6ca58e54bb265d.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
-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