jerenkrantz 02/01/24 18:21:43
Modified: threadproc/unix proc.c
Log:
Fix leakage with fds with respect to pipes. dup2() should close the old
file descriptor and this new one will be closed when we clean up the pipe.
Revision Changes Path
1.54 +6 -6 apr/threadproc/unix/proc.c
Index: proc.c
===================================================================
RCS file: /home/cvs/apr/threadproc/unix/proc.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- proc.c 11 Nov 2001 05:51:00 -0000 1.53
+++ proc.c 25 Jan 2002 02:21:43 -0000 1.54
@@ -141,10 +141,10 @@
apr_file_pipe_create(&attr->child_in, &attr->parent_in, attr->cntxt);
if (child_in != NULL)
- apr_file_dup(&attr->child_in, child_in, attr->cntxt);
+ apr_file_dup2(attr->child_in, child_in, attr->cntxt);
if (parent_in != NULL)
- apr_file_dup(&attr->parent_in, parent_in, attr->cntxt);
+ apr_file_dup2(attr->parent_in, parent_in, attr->cntxt);
return APR_SUCCESS;
}
@@ -157,10 +157,10 @@
apr_file_pipe_create(&attr->child_out, &attr->parent_out,
attr->cntxt);
if (child_out != NULL)
- apr_file_dup(&attr->child_out, child_out, attr->cntxt);
+ apr_file_dup2(attr->child_out, child_out, attr->cntxt);
if (parent_out != NULL)
- apr_file_dup(&attr->parent_out, parent_out, attr->cntxt);
+ apr_file_dup2(attr->parent_out, parent_out, attr->cntxt);
return APR_SUCCESS;
}
@@ -173,10 +173,10 @@
apr_file_pipe_create(&attr->child_err, &attr->parent_err,
attr->cntxt);
if (child_err != NULL)
- apr_file_dup(&attr->child_err, child_err, attr->cntxt);
+ apr_file_dup2(attr->child_err, child_err, attr->cntxt);
if (parent_err != NULL)
- apr_file_dup(&attr->parent_err, parent_err, attr->cntxt);
+ apr_file_dup2(attr->parent_err, parent_err, attr->cntxt);
return APR_SUCCESS;
}