You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by sf...@apache.org on 2011/10/15 22:47:16 UTC
svn commit: r1183685 - in /apr/apr/trunk: CHANGES threadproc/unix/proc.c
Author: sf
Date: Sat Oct 15 20:47:15 2011
New Revision: 1183685
URL: http://svn.apache.org/viewvc?rev=1183685&view=rev
Log:
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>]
Modified:
apr/apr/trunk/CHANGES
apr/apr/trunk/threadproc/unix/proc.c
Modified: apr/apr/trunk/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/trunk/CHANGES?rev=1183685&r1=1183684&r2=1183685&view=diff
==============================================================================
--- apr/apr/trunk/CHANGES [utf-8] (original)
+++ apr/apr/trunk/CHANGES [utf-8] Sat Oct 15 20:47:15 2011
@@ -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
Modified: apr/apr/trunk/threadproc/unix/proc.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/threadproc/unix/proc.c?rev=1183685&r1=1183684&r2=1183685&view=diff
==============================================================================
--- apr/apr/trunk/threadproc/unix/proc.c (original)
+++ apr/apr/trunk/threadproc/unix/proc.c Sat Oct 15 20:47:15 2011
@@ -431,7 +431,8 @@ APR_DECLARE(apr_status_t) apr_proc_creat
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_creat
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_creat
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);
}