diff options
author | Miles Bader <miles@gnu.org> | 1995-08-12 01:06:32 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1995-08-12 01:06:32 +0000 |
commit | 3632248b212af27b158b899d6156354dd32614ee (patch) | |
tree | fb930226b083b4c208d764c458ff0493e88eeaa8 | |
parent | e958ba53f23ee8e88cc30a7d5838f208c400ec9d (diff) |
(trivfs_S_io_reauthenticate): Allow trivfs_protid_create_hook to return an
error code.
-rw-r--r-- | libtrivfs/io-reauthenticate.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/libtrivfs/io-reauthenticate.c b/libtrivfs/io-reauthenticate.c index 9581720f..8deffa99 100644 --- a/libtrivfs/io-reauthenticate.c +++ b/libtrivfs/io-reauthenticate.c @@ -79,20 +79,23 @@ trivfs_S_io_reauthenticate (struct trivfs_protid *cred, newcred->hook = cred->hook; mutex_lock (&cred->po->cntl->lock); - newcred->po = cred->po; newcred->po->refcnt++; - mutex_unlock (&cred->po->cntl->lock); err = io_restrict_auth (newcred->po->cntl->underlying, &newcred->realnode, gen_uids, genuidlen, gen_gids, gengidlen); + if (!err && trivfs_protid_create_hook) + { + err = (*trivfs_protid_create_hook) (newcred); + if (err) + mach_port_deallocate (mach_task_self (), newcred->realnode); + } + if (err) + /* Signal that the user destroy hook shouldn't be called on NEWCRED. */ newcred->realnode = MACH_PORT_NULL; - if (trivfs_protid_create_hook) - (*trivfs_protid_create_hook) (newcred); - if (gubuf != gen_uids) vm_deallocate (mach_task_self (), (u_int) gen_uids, genuidlen * sizeof (uid_t)); @@ -106,7 +109,7 @@ trivfs_S_io_reauthenticate (struct trivfs_protid *cred, vm_deallocate (mach_task_self (), (u_int) aux_gids, auxgidlen * sizeof (uid_t)); - ports_port_deref (newcred); - return 0; + + return err; } |