summaryrefslogtreecommitdiff
path: root/libports/create-internal.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2001-03-31 23:06:43 +0000
committerRoland McGrath <roland@gnu.org>2001-03-31 23:06:43 +0000
commitb5a4fc2bc5ee18907945cb5cd9eb792dc4f4b19e (patch)
tree3d08c9d3337057c1e8591e685d1d663fe6042d9e /libports/create-internal.c
parenta6bf96a0896f42f4a737316d2d0d0ea1d3c0c114 (diff)
2001-03-29 Neal H Walfield <neal@cs.uml.edu>
* create-internal.c (_ports_create_internal): On error, do not deallocate a send right, but a receive right.
Diffstat (limited to 'libports/create-internal.c')
-rw-r--r--libports/create-internal.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/libports/create-internal.c b/libports/create-internal.c
index bc97ce62..b50212ea 100644
--- a/libports/create-internal.c
+++ b/libports/create-internal.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1996 Free Software Foundation, Inc.
+ Copyright (C) 1996,2001 Free Software Foundation, Inc.
Written by Michael I. Bushnell, p/BSG.
This file is part of the GNU Hurd.
@@ -48,7 +48,9 @@ _ports_create_port_internal (struct port_class *class,
pi = malloc (size);
if (! pi)
{
- mach_port_deallocate (mach_task_self (), port);
+ err = mach_port_mod_refs (mach_task_self (), port,
+ MACH_PORT_RIGHT_RECEIVE, -1);
+ assert_perror (err);
return ENOMEM;
}
@@ -94,7 +96,12 @@ _ports_create_port_internal (struct port_class *class,
mutex_unlock (&_ports_lock);
if (install)
- mach_port_move_member (mach_task_self (), pi->port_right, bucket->portset);
+ {
+ err = mach_port_move_member (mach_task_self (), pi->port_right,
+ bucket->portset);
+ if (err)
+ goto lose;
+ }
*(void **)result = pi;
return 0;
@@ -103,7 +110,9 @@ _ports_create_port_internal (struct port_class *class,
err = EINTR;
lose:
mutex_unlock (&_ports_lock);
- mach_port_mod_refs (mach_task_self (), port, MACH_PORT_RIGHT_RECEIVE, -1);
+ err = mach_port_mod_refs (mach_task_self (), port,
+ MACH_PORT_RIGHT_RECEIVE, -1);
+ assert_perror (err);
free (pi);
return err;