diff options
Diffstat (limited to 'libnetfs/dir-mkfile.c')
-rw-r--r-- | libnetfs/dir-mkfile.c | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/libnetfs/dir-mkfile.c b/libnetfs/dir-mkfile.c index 89212daa..7d388737 100644 --- a/libnetfs/dir-mkfile.c +++ b/libnetfs/dir-mkfile.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995,96,97,2001 Free Software Foundation, Inc. Written by Michael I. Bushnell, p/BSG. This file is part of the GNU Hurd. @@ -28,25 +28,37 @@ netfs_S_dir_mkfile (struct protid *diruser, int flags, mode_t mode, { error_t err; struct node *np; + struct iouser *user; struct protid *newpi; mutex_lock (&diruser->po->np->lock); - err = netfs_attempt_mkfile (diruser->credential, diruser->po->np, mode, &np); + err = netfs_attempt_mkfile (diruser->user, diruser->po->np, mode, &np); if (!err) { /* the dir is now unlocked and NP is locked */ flags &= OPENONLY_STATE_MODES; - newpi = netfs_make_protid (netfs_make_peropen (np, flags, - diruser->po->dotdotport), - netfs_copy_credential (diruser->credential)); - *newfile = ports_get_right (newpi); - *newfiletype = MACH_MSG_TYPE_MAKE_SEND; - ports_port_deref (newpi); + err = iohelp_dup_iouser (&user, diruser->user); + if (! err) + { + newpi = netfs_make_protid (netfs_make_peropen (np, flags, + diruser->po), + user); + if (newpi) + { + *newfile = ports_get_right (newpi); + *newfiletype = MACH_MSG_TYPE_MAKE_SEND; + ports_port_deref (newpi); + } + else + { + err = errno; + iohelp_free_iouser (user); + } + } netfs_nput (np); - return 0; } - else - return err; + + return err; } |