diff options
author | Michael I. Bushnell <mib@gnu.org> | 1996-03-20 18:42:37 +0000 |
---|---|---|
committer | Michael I. Bushnell <mib@gnu.org> | 1996-03-20 18:42:37 +0000 |
commit | 5a71edcee3770b365c112e085ed5e1848d40c300 (patch) | |
tree | 82615148d3c45753c9d9aa948e8dd504bb7ba9f7 /libports/claim-right.c | |
parent | c8f645deb2eb00d721fe17344dd327bde5701b4a (diff) |
(ports_claim_right):
Diffstat (limited to 'libports/claim-right.c')
-rw-r--r-- | libports/claim-right.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/libports/claim-right.c b/libports/claim-right.c index 827aa79a..2569fa77 100644 --- a/libports/claim-right.c +++ b/libports/claim-right.c @@ -26,15 +26,24 @@ mach_port_t ports_claim_right (void *portstruct) { struct port_info *pi = portstruct; - - mutex_lock (&_ports_lock); - ihash_locp_remove (pi->bucket->htable, pi->hentry); - mutex_unlock (&_ports_lock); - pi->port_right = MACH_PORT_NULL; - if (pi->flags & PORT_HAS_SENDRIGHTS) + mach_port_t ret; + + if (pi->port_right != MACH_PORT_NULL) { - pi->flags &= ~PORT_HAS_SENDRIGHTS; - ports_port_deref (pi); + ret = pi->port_right; + + mutex_lock (&_ports_lock); + ihash_locp_remove (pi->bucket->htable, pi->hentry); + mutex_unlock (&_ports_lock); + pi->port_right = MACH_PORT_NULL; + if (pi->flags & PORT_HAS_SENDRIGHTS) + { + pi->flags &= ~PORT_HAS_SENDRIGHTS; + ports_port_deref (pi); + } } + else + ret = MACH_PORT_NULL; + return ret; } |