summaryrefslogtreecommitdiff
path: root/libfshelp
diff options
context:
space:
mode:
authorJustus Winter <justus@gnupg.org>2016-10-05 15:09:11 +0200
committerJustus Winter <justus@gnupg.org>2017-09-12 10:41:35 +0200
commit116552c075abf1d22057a608fee9d27684bcbbe5 (patch)
tree97e5590b5196430dcf0e22c0a9206137aff80f1e /libfshelp
parent978a819485e1e301c49b41fb629656d157d61ec6 (diff)
libfshelp: Always register dead-name notifications.
* libfshelp/translator-list.c (fshelp_set_active_translator): Always register dead-name notifications.
Diffstat (limited to 'libfshelp')
-rw-r--r--libfshelp/translator-list.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/libfshelp/translator-list.c b/libfshelp/translator-list.c
index 52031286..b8fe3f94 100644
--- a/libfshelp/translator-list.c
+++ b/libfshelp/translator-list.c
@@ -116,27 +116,24 @@ fshelp_set_active_translator (struct port_info *pi,
goto out;
update:
- if (active)
+ if (MACH_PORT_VALID (active))
{
- if (t->pi != pi)
- {
- mach_port_t old;
- err = mach_port_request_notification (mach_task_self (), active,
- MACH_NOTIFY_DEAD_NAME, 0,
- pi->port_right,
- MACH_MSG_TYPE_MAKE_SEND_ONCE,
- &old);
- if (err)
- goto out;
- if (old != MACH_PORT_NULL)
- mach_port_deallocate (mach_task_self (), old);
+ mach_port_t old;
+ err = mach_port_request_notification (mach_task_self (), active,
+ MACH_NOTIFY_DEAD_NAME, 0,
+ pi->port_right,
+ MACH_MSG_TYPE_MAKE_SEND_ONCE,
+ &old);
+ if (err)
+ goto out;
+ if (old != MACH_PORT_NULL)
+ mach_port_deallocate (mach_task_self (), old);
- if (t->pi)
- ports_port_deref (t->pi);
+ if (t->pi)
+ ports_port_deref (t->pi);
- ports_port_ref (pi);
- t->pi = pi;
- }
+ ports_port_ref (pi);
+ t->pi = pi;
if (MACH_PORT_VALID (t->active))
mach_port_deallocate (mach_task_self (), t->active);