diff options
author | Miles Bader <miles@gnu.org> | 1996-02-21 22:17:09 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1996-02-21 22:17:09 +0000 |
commit | d583c2bf9159456ec145a99eacf29d6df4331f2b (patch) | |
tree | 0e4e42fd2ef610eb6cbc3f46714b9c5787f90aa9 /libfshelp | |
parent | b2931bd043fb73cbe498204e5a733af1350a2234 (diff) |
(fshelp_set_active):
When EXCL, make sure the active translator is really active.
Diffstat (limited to 'libfshelp')
-rw-r--r-- | libfshelp/set-active.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/libfshelp/set-active.c b/libfshelp/set-active.c index f2cc297b..4f25a50e 100644 --- a/libfshelp/set-active.c +++ b/libfshelp/set-active.c @@ -28,9 +28,23 @@ fshelp_set_active (struct transbox *box, { int cancel; - if (excl - && ((box->active != MACH_PORT_NULL) || (box->flags & TRANSBOX_STARTING))) - return EBUSY; + if (excl) + { + if (box->flags & TRANSBOX_STARTING) + return EBUSY; + if (box->active != MACH_PORT_NULL) + /* It looks like there's an existing translator, but make sure. */ + { + mach_port_urefs_t dead_refs; + error_t err = + mach_port_get_refs (mach_task_self (), + box->active, MACH_PORT_RIGHT_DEAD_NAME, + &dead_refs); + if (!err && dead_refs == 0) + /* Still active, we lose. */ + return EBUSY; + } + } while (box->flags & TRANSBOX_STARTING) { |