summaryrefslogtreecommitdiff
path: root/threadproc/unix
diff options
context:
space:
mode:
authorsctemme <sctemme@13f79535-47bb-0310-9956-ffa450edef68>2011-11-07 18:29:46 +0000
committersctemme <sctemme@13f79535-47bb-0310-9956-ffa450edef68>2011-11-07 18:29:46 +0000
commit4e44d084ac3c6fc2f7a50b555aab05aa89125464 (patch)
tree4197f814638b31bd8cbaea61c1a1cb15ccd3a743 /threadproc/unix
parent9e498d4c61e3fe8c0a378a91641a35259bb787fd (diff)
downloadlibapr-4e44d084ac3c6fc2f7a50b555aab05aa89125464.tar.gz
Clarify what happens to the proc structure used by apr_fork().
Set the proc->pid field to the pid of the newly created child. Note that a mere pid value provides little entropy to mix into the child random pool. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1198860 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'threadproc/unix')
-rw-r--r--threadproc/unix/proc.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/threadproc/unix/proc.c b/threadproc/unix/proc.c
index 8ded39177..004772ff8 100644
--- a/threadproc/unix/proc.c
+++ b/threadproc/unix/proc.c
@@ -219,15 +219,14 @@ APR_DECLARE(apr_status_t) apr_procattr_detach_set(apr_procattr_t *attr,
APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool)
{
int pid;
+
+ memset(proc, 0, sizeof(apr_proc_t));
if ((pid = fork()) < 0) {
return errno;
}
else if (pid == 0) {
- proc->pid = pid;
- proc->in = NULL;
- proc->out = NULL;
- proc->err = NULL;
+ proc->pid = getpid();
apr_random_after_fork(proc);
@@ -235,9 +234,6 @@ APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool)
}
proc->pid = pid;
- proc->in = NULL;
- proc->out = NULL;
- proc->err = NULL;
return APR_INPARENT;
}