diff options
author | Sander Temme <sctemme@apache.org> | 2011-11-07 18:29:46 +0000 |
---|---|---|
committer | Sander Temme <sctemme@apache.org> | 2011-11-07 18:29:46 +0000 |
commit | 72062d84633b8996646a83c6c254cfed8455c90a (patch) | |
tree | 4197f814638b31bd8cbaea61c1a1cb15ccd3a743 /threadproc | |
parent | 8ec57c2423fd2d4847293a4651b67126bac63f6e (diff) | |
download | apr-72062d84633b8996646a83c6c254cfed8455c90a.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: https://svn.apache.org/repos/asf/apr/apr/trunk@1198860 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'threadproc')
-rw-r--r-- | threadproc/unix/proc.c | 10 |
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; } |