summaryrefslogtreecommitdiff
path: root/libtrivfs/io-duplicate.c
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1994-06-15 22:51:19 +0000
committerMichael I. Bushnell <mib@gnu.org>1994-06-15 22:51:19 +0000
commitebb3aee3002ebb8420be9cfe471a051ad1c00524 (patch)
treec43bb86dcef7adf204bc6fd0daef8723866411da /libtrivfs/io-duplicate.c
parent5772acb106ee9d48ffc4d99d193f0513e06c14c6 (diff)
Formerly io-duplicate.c.~4~
Diffstat (limited to 'libtrivfs/io-duplicate.c')
-rw-r--r--libtrivfs/io-duplicate.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/libtrivfs/io-duplicate.c b/libtrivfs/io-duplicate.c
index 6cd50966..4fdd88b4 100644
--- a/libtrivfs/io-duplicate.c
+++ b/libtrivfs/io-duplicate.c
@@ -32,14 +32,23 @@ trivfs_S_io_duplicate (struct trivfs_protid *cred,
if (!cred)
return EOPNOTSUPP;
- newcred = ports_allocate_port (sizeof (struct trivfs_protid),
- trivfs_protid_porttype);
+ newcred = ports_allocate_port (sizeof (struct trivfs_protid), cred->pi.type);
newcred->realnode = cred->realnode;
newcred->isroot = cred->isroot;
- newcred->cntl = cred->cntl;
- ports_port_ref (newcred->cntl);
+ newcred->po = cred->po;
+ newcred->po->refcnt++;
+ newcred->uids = malloc (cred->nuids * sizeof (uid_t));
+ newcred->gids = malloc (cred->ngids * sizeof (gid_t));
+ bcopy (cred->uids, newcred->uids, cred->nuids * sizeof (uid_t));
+ bcopy (cred->gids, newcred->gids, cred->ngids * sizeof (uid_t));
+ newcred->nuids = cred->nuids;
+ newcred->ngids = cred->ngids;
mach_port_mod_refs (mach_task_self (), newcred->realnode,
MACH_PORT_RIGHT_SEND, 1);
+
+ if (trivfs_protid_create_hook)
+ (*trivfs_protid_create_hook) (newcred);
+
*newport = ports_get_right (newcred);
*newporttype = MACH_MSG_TYPE_MAKE_SEND;
return 0;