summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1996-03-29 15:22:50 +0000
committerMichael I. Bushnell <mib@gnu.org>1996-03-29 15:22:50 +0000
commite5c73a37cc8acc4cf12b18df08b7fe10f5d83cf8 (patch)
tree74eae42e9ae9e42a8cc60007324336e7571d1cd5
parent07a9e1c2c2eaff10eee4e1e8ca5cdbf4b429ad54 (diff)
(_ports_complete_deallocate): Only drop port right if it isn't already
null.
-rw-r--r--libports/complete-deallocate.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/libports/complete-deallocate.c b/libports/complete-deallocate.c
index a0e4e7e0..a94ab171 100644
--- a/libports/complete-deallocate.c
+++ b/libports/complete-deallocate.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1995 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996 Free Software Foundation, Inc.
Written by Michael I. Bushnell.
This file is part of the GNU Hurd.
@@ -28,7 +28,14 @@ _ports_complete_deallocate (struct port_info *pi)
{
assert ((pi->flags & PORT_HAS_SENDRIGHTS) == 0);
- ihash_locp_remove (pi->bucket->htable, pi->hentry);
+ if (pi->port_right)
+ {
+ ihash_locp_remove (pi->bucket->htable, pi->hentry);
+ mach_port_mod_refs (mach_task_self (), pi->port_right,
+ MACH_PORT_RIGHT_RECEIVE, -1);
+ pi->port_right = MACH_PORT_NULL;
+ }
+
*pi->prevp = pi->next;
if (pi->next)
pi->next->prevp = pi->prevp;
@@ -36,9 +43,6 @@ _ports_complete_deallocate (struct port_info *pi)
pi->bucket->count--;
pi->class->count--;
- mach_port_mod_refs (mach_task_self (), pi->port_right,
- MACH_PORT_RIGHT_RECEIVE, -1);
- pi->port_right = MACH_PORT_NULL;
mutex_unlock (&_ports_lock);
if (pi->class->clean_routine)