diff options
author | Rainer Jung <rjung@apache.org> | 2011-11-08 02:54:40 +0000 |
---|---|---|
committer | Rainer Jung <rjung@apache.org> | 2011-11-08 02:54:40 +0000 |
commit | 75cf8a67aadb76238335567c3c7bdc74d4649d19 (patch) | |
tree | 86b80ef0c483e8736799e16b6af545bcf0dd4dc0 /threadproc | |
parent | 06c58eb40010b10ef727de9dd07489edec8b4a77 (diff) | |
download | apr-75cf8a67aadb76238335567c3c7bdc74d4649d19.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.
Backport of r1198860 from trunk.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1199082 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 69d3690ce..3588a86b0 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; } |