summaryrefslogtreecommitdiff
path: root/hurd
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1994-09-30 21:45:18 +0000
committerRoland McGrath <roland@gnu.org>1994-09-30 21:45:18 +0000
commit4bbcc5d0e776e6cca9723e6e66ea76f44fa49ee2 (patch)
tree8ce94fa5013724308bac6a579ecc077d07cf6657 /hurd
parent1fb6141689cea28f43a621e700d4ae295aeb259d (diff)
(_hurd_setcttyid): Don't do mod_refs if port is null.
Diffstat (limited to 'hurd')
-rw-r--r--hurd/hurdioctl.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/hurd/hurdioctl.c b/hurd/hurdioctl.c
index 5e1233c4e0..d39d27cb56 100644
--- a/hurd/hurdioctl.c
+++ b/hurd/hurdioctl.c
@@ -169,11 +169,14 @@ _hurd_setcttyid (mach_port_t cttyid)
{
error_t err;
- /* Give the new send right a user reference.
- This is a good way to check that it is valid. */
- if (err = __mach_port_mod_refs (__mach_task_self (), cttyid,
- MACH_PORT_RIGHT_SEND, 1))
- return err;
+ if (cttyid != MACH_PORT_NULL)
+ {
+ /* Give the new send right a user reference.
+ This is a good way to check that it is valid. */
+ if (err = __mach_port_mod_refs (__mach_task_self (), cttyid,
+ MACH_PORT_RIGHT_SEND, 1))
+ return err;
+ }
/* Install the port, consuming the reference we just created. */
_hurd_port_set (&_hurd_ports[INIT_PORT_CTTYID], cttyid);