diff options
author | Michael I. Bushnell <mib@gnu.org> | 1996-04-23 15:04:59 +0000 |
---|---|---|
committer | Michael I. Bushnell <mib@gnu.org> | 1996-04-23 15:04:59 +0000 |
commit | 804b2f7a0f500bd81a3083df4d094f527c8682db (patch) | |
tree | 5cb576be6da6738a07ef8cd8c922ef88bdd710e9 | |
parent | 55217310a5f15d1cd5f79a95cdffe830b94fb24e (diff) |
(diskfs_S_ifsock_getsockaddr): Request notification for new SOCKADDR;
count that notification as a reference.
-rw-r--r-- | libdiskfs/ifsock.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/libdiskfs/ifsock.c b/libdiskfs/ifsock.c index b7df10cf..2b02554b 100644 --- a/libdiskfs/ifsock.c +++ b/libdiskfs/ifsock.c @@ -1,5 +1,5 @@ /* Implement ifsock inteface - Copyright (C) 1994 Free Software Foundation + Copyright (C) 1994, 1996 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -56,6 +56,7 @@ diskfs_S_ifsock_getsockaddr (struct protid *cred, { mach_port_t server; mach_port_t sockaddr; + mach_port_t old; mutex_unlock (&np->lock); @@ -111,7 +112,20 @@ diskfs_S_ifsock_getsockaddr (struct protid *cred, /* Someone beat us */ mach_port_deallocate (mach_task_self (), sockaddr); else - np->sockaddr = sockaddr; + { + /* The receive right of the sockaddr holds a reference; + when we get a dead name on that right we drop our + reference. */ + mach_port_request_notification (mach_task_self (), sockaddr, + MACH_NOTIFY_DEAD_NAME, 1, + np->pi.port_right, + MACH_PORT_MAKE_SEND_ONCE, + &old); + if (old != MACH_PORT_NULL) + mach_port_deallocate (mach_task_self (), old); + np->sockaddr = sockaddr; + diskfs_nref (np); + } } *address = np->sockaddr; |