summaryrefslogtreecommitdiff
path: root/libtrivfs/fsys-getroot.c
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1994-02-18 21:07:56 +0000
committerMichael I. Bushnell <mib@gnu.org>1994-02-18 21:07:56 +0000
commitdb11702623a95a0bc7483a93f58b22d451042613 (patch)
treec69500bbc55046c97d3dab433971f756c2ee702e /libtrivfs/fsys-getroot.c
parent02a2fb99f76fcfb62c8bc2f3047f07261cd43f8d (diff)
Formerly fsys-getroot.c.~2~
Diffstat (limited to 'libtrivfs/fsys-getroot.c')
-rw-r--r--libtrivfs/fsys-getroot.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libtrivfs/fsys-getroot.c b/libtrivfs/fsys-getroot.c
index 7820aec9..52089ac4 100644
--- a/libtrivfs/fsys-getroot.c
+++ b/libtrivfs/fsys-getroot.c
@@ -31,12 +31,20 @@ trivfs_S_fsys_getroot (mach_port_t fsys,
{
struct protid *cred;
int i;
+ struct port_info *pi;
+
+ pi = ports_get_port (fsys, PT_CTL);
+ if (!pi)
+ return EOPNOTSUPP;
assert (!trivfs_support_read && !trivfs_support_write
&& !trivfs_support_exec);
if (flags & (O_READ|O_WRITE|O_EXEC))
- return EACCES;
+ {
+ ports_done_with_port (pi);
+ return EACCES;
+ }
cred = ports_allocate_port (sizeof (struct protid), PT_PROTID);
cred->isroot = 0;
@@ -47,6 +55,7 @@ trivfs_S_fsys_getroot (mach_port_t fsys,
uids, nuids, gids, ngids);
*newpt = ports_get_right (cred);
*newpttype = MACH_MSG_TYPE_MAKE_SEND;
+ ports_done_with_port (pi);
return 0;
}