Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/nfs initialize read creds in nfs_open() too.



details:   https://anonhg.NetBSD.org/src/rev/e3b95a6ef5fb
branches:  trunk
changeset: 500465:e3b95a6ef5fb
user:      chs <chs%NetBSD.org@localhost>
date:      Tue Dec 12 17:13:17 2000 +0000

description:
initialize read creds in nfs_open() too.

diffstat:

 sys/nfs/nfs_vnops.c |  13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diffs (29 lines):

diff -r 44ed4837e42d -r e3b95a6ef5fb sys/nfs/nfs_vnops.c
--- a/sys/nfs/nfs_vnops.c       Tue Dec 12 17:07:49 2000 +0000
+++ b/sys/nfs/nfs_vnops.c       Tue Dec 12 17:13:17 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfs_vnops.c,v 1.125 2000/11/30 07:24:12 chs Exp $      */
+/*     $NetBSD: nfs_vnops.c,v 1.126 2000/12/12 17:13:17 chs Exp $      */
 
 /*
  * Copyright (c) 1989, 1993
@@ -440,10 +440,17 @@
        }
 
        /*
-        * if we're opening with write access, initialize the write creds
-        * in case we only write via memory mappings.
+        * 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);



Home | Main Index | Thread Index | Old Index