diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2001-12-22 09:58:05 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2001-12-22 09:58:05 +0000 |
commit | 758c4f16981e6987a5e1f1425f91edfaf1093714 (patch) | |
tree | 8877bef078685d28467c023212370ea1b1e32733 /sys | |
parent | 9f900604dbc423473ab9e941ac8feb88f9753e73 (diff) |
Init the creds in nfs_open too.
Repairs swap over nfs. Tested by hugh@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/nfs/nfs_vnops.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c index 44cceab8a1f..14c28a1e302 100644 --- a/sys/nfs/nfs_vnops.c +++ b/sys/nfs/nfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_vnops.c,v 1.45 2001/12/19 08:58:06 art Exp $ */ +/* $OpenBSD: nfs_vnops.c,v 1.46 2001/12/22 09:58:04 art Exp $ */ /* $NetBSD: nfs_vnops.c,v 1.62.4.1 1996/07/08 20:26:52 jtc Exp $ */ /* @@ -373,6 +373,26 @@ nfs_open(v) return (EACCES); } + /* + * Initialize read and write creds here, for swapfiles + * and other paths that don't set the creds themselves. + */ + + if (ap->a_mode & FREAD) { + if (np->n_rcred) { + crfree(np->n_rcred); + } + np->n_rcred = ap->a_cred; + crhold(np->n_rcred); + } + if (ap->a_mode & FWRITE) { + if (np->n_wcred) { + crfree(np->n_wcred); + } + np->n_wcred = ap->a_cred; + crhold(np->n_wcred); + } + if (np->n_flag & NMODIFIED) { if ((error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_p, 1)) == EINTR) |