aboutsummaryrefslogtreecommitdiff
path: root/libdiskfs/trans-callback.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdiskfs/trans-callback.c')
-rw-r--r--libdiskfs/trans-callback.c37
1 files changed, 27 insertions, 10 deletions
diff --git a/libdiskfs/trans-callback.c b/libdiskfs/trans-callback.c
index 7701199b..283b184f 100644
--- a/libdiskfs/trans-callback.c
+++ b/libdiskfs/trans-callback.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+/*
+ Copyright (C) 1995,96,97,98,2001,02 Free Software Foundation, Inc.
Written by Michael I. Bushnell.
This file is part of the GNU Hurd.
@@ -26,17 +26,20 @@
static error_t
_diskfs_translator_callback1_fn (void *cookie1, void *cookie2,
uid_t *uid, gid_t *gid,
- char **argz, int *argz_len)
+ char **argz, size_t *argz_len)
{
error_t err;
struct node *np = cookie1;
- if (!np->istranslated)
+ if (! (np->dn_stat.st_mode & S_IPTRANS))
return ENOENT;
err = diskfs_get_translator (np, argz, (u_int *) argz_len);
if (err)
- return err;
+ {
+ assert (err != EOPNOTSUPP);
+ return err;
+ }
*uid = np->dn_stat.st_uid;
*gid = np->dn_stat.st_gid;
@@ -53,12 +56,26 @@ _diskfs_translator_callback2_fn (void *cookie1, void *cookie2,
mach_msg_type_name_t *underlying_type)
{
struct node *np = cookie1;
- mach_port_t *dotdot = cookie2;
struct protid *cred;
- error_t err =
- diskfs_create_protid (diskfs_make_peropen (np, flags, *dotdot),
- &np->dn_stat.st_uid, 1, &np->dn_stat.st_gid, 1,
- &cred);
+ struct peropen *po;
+ error_t err;
+ struct iouser *user;
+
+ err = iohelp_create_simple_iouser (&user, np->dn_stat.st_uid,
+ np->dn_stat.st_gid);
+ if (err)
+ return err;
+
+ err = diskfs_make_peropen (np, flags, cookie2, &po);
+ if (! err)
+ {
+ err = diskfs_create_protid (po, user, &cred);
+ if (err)
+ diskfs_release_peropen (po);
+ }
+
+ iohelp_free_iouser (user);
+
if (! err)
{
*underlying = ports_get_right (cred);