summaryrefslogtreecommitdiff
path: root/sys/kern/kern_fork.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2004-05-24 02:51:23 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2004-05-24 02:51:23 +0000
commit35c2ffa34ec65e952ceee25a773e14187b3104c0 (patch)
treeb7094b9f091d6f532ec2cd32f0e050c6fdf09352 /sys/kern/kern_fork.c
parent61971900f6626ea5e57221d2e6eca4a6d655b278 (diff)
No way: This breaks nearly every architecture
Diffstat (limited to 'sys/kern/kern_fork.c')
-rw-r--r--sys/kern/kern_fork.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index b2b196c20b9..a3b887a9ca9 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_fork.c,v 1.65 2004/05/23 19:37:24 tedu Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.66 2004/05/24 02:51:22 deraadt Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@@ -184,6 +184,10 @@ fork1(struct proc *p1, int exitsig, int flags, void *stack, size_t stacksize,
/* Allocate new proc. */
p2 = pool_get(&proc_pool, PR_WAITOK);
+ p2->p_stat = SIDL; /* protect against others */
+ p2->p_exitsig = exitsig;
+ p2->p_forw = p2->p_back = NULL;
+
/*
* Make a proc table entry for the new process.
* Start by zeroing the section of proc that is zero-initialized,
@@ -193,8 +197,6 @@ fork1(struct proc *p1, int exitsig, int flags, void *stack, size_t stacksize,
(unsigned) ((caddr_t)&p2->p_endzero - (caddr_t)&p2->p_startzero));
bcopy(&p1->p_startcopy, &p2->p_startcopy,
(unsigned) ((caddr_t)&p2->p_endcopy - (caddr_t)&p2->p_startcopy));
- p2->p_stat = SIDL; /* protect against others */
- p2->p_exitsig = exitsig;
/*
* Initialize the timeouts.
@@ -369,10 +371,8 @@ fork1(struct proc *p1, int exitsig, int flags, void *stack, size_t stacksize,
* Return child pid to parent process,
* marking us as parent via retval[1].
*/
- if (retval != NULL) {
- retval[0] = p2->p_pid;
- retval[1] = 0;
- }
+ retval[0] = p2->p_pid;
+ retval[1] = 0;
return (0);
}