From f89dd27b65eb3fe12309c182e784b46df5d0d65b Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sat, 27 Apr 1996 10:03:04 +0000 Subject: Use ports_create_port instead of ports_allocate_port, and notice the error. --- libnetfs/file-getcontrol.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'libnetfs') diff --git a/libnetfs/file-getcontrol.c b/libnetfs/file-getcontrol.c index 7c4f1fee..0201577b 100644 --- a/libnetfs/file-getcontrol.c +++ b/libnetfs/file-getcontrol.c @@ -1,5 +1,5 @@ /* Return the filesystem corresponding to a file - + Copyright (C) 1995, 1996 Free Software Foundation, Inc. Written by Michael I. Bushnell, p/BSG. @@ -27,6 +27,7 @@ netfs_S_file_getcontrol (struct protid *user, mach_port_t *control, mach_msg_type_name_t *controltype) { + error_t err; struct port_info *pi; uid_t *uids, *gids; int nuids, ngids; @@ -34,26 +35,28 @@ netfs_S_file_getcontrol (struct protid *user, if (!user) return EOPNOTSUPP; - + mutex_lock (&user->po->np->lock); netfs_interpret_credential (user->credential, &uids, &nuids, &gids, &ngids); mutex_unlock (&user->po->np->lock); free (gids); - + for (i = 0; i < nuids; i++) if (uids[i] == 0) { /* They've got root; give it to them. */ free (uids); - pi = ports_allocate_port (netfs_port_bucket, - sizeof (struct port_info), - netfs_control_class); + err = ports_create_port (netfs_port_bucket, + sizeof (struct port_info), + netfs_control_class, &pi); + if (err) + return err; *control = ports_get_right (pi); *controltype = MACH_MSG_TYPE_MAKE_SEND; ports_port_deref (pi); return 0; } - + /* Not got root. */ free (uids); return EPERM; -- cgit v1.2.3