summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>1999-07-15 14:11:06 +0000
committerArtur Grabowski <art@cvs.openbsd.org>1999-07-15 14:11:06 +0000
commit7bdb8bc6dd617efd36012f956c9992b1cfa8e85c (patch)
tree54d1ac29efc0e963f5b33d4f5b1295cdb09c6dfa
parent388ce0bc8d4ed3c140be5ac53ac580c6e59e682d (diff)
Don't destroy sysvshm if the vmspace is shared (only affects uvm)
-rw-r--r--sys/kern/kern_exec.c4
-rw-r--r--sys/kern/kern_exit.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 9d8bf191c5a..51920ebba64 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exec.c,v 1.31 1999/07/15 14:07:41 art Exp $ */
+/* $OpenBSD: kern_exec.c,v 1.32 1999/07/15 14:11:05 art Exp $ */
/* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */
/*-
@@ -386,7 +386,7 @@ sys_execve(p, v, retval)
#endif
/* Kill shared memory and unmap old program */
#ifdef SYSVSHM
- if (vm->vm_shm)
+ if (vm->vm_shm && vm->vm_refcnt == 1)
shmexit(vm);
#endif
vm_deallocate(&vm->vm_map, VM_MIN_ADDRESS,
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 3f9ad4c9711..b0d9b8263b2 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exit.c,v 1.18 1999/06/23 09:44:28 art Exp $ */
+/* $OpenBSD: kern_exit.c,v 1.19 1999/07/15 14:11:05 art Exp $ */
/* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */
/*
@@ -146,7 +146,7 @@ exit1(p, rv)
/* The next three chunks should probably be moved to vmspace_exit. */
vm = p->p_vmspace;
#ifdef SYSVSHM
- if (vm->vm_shm)
+ if (vm->vm_shm && vm->vm_refcnt == 1)
shmexit(vm);
#endif
#ifdef SYSVSEM