Source-Changes-HG archive

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

[src/trunk]: src/sys/miscfs/union Fixes PR #1206, by setting va_mode and va_f...



details:   https://anonhg.NetBSD.org/src/rev/eb23eae61201
branches:  trunk
changeset: 474007:eb23eae61201
user:      perseant <perseant%NetBSD.org@localhost>
date:      Fri Jun 25 19:05:49 1999 +0000

description:
Fixes PR #1206, by setting va_mode and va_flags in the copied-up vnode's
attributes.

diffstat:

 sys/miscfs/union/union_subr.c |  15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diffs (40 lines):

diff -r c089c458d701 -r eb23eae61201 sys/miscfs/union/union_subr.c
--- a/sys/miscfs/union/union_subr.c     Fri Jun 25 18:58:54 1999 +0000
+++ b/sys/miscfs/union/union_subr.c     Fri Jun 25 19:05:49 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: union_subr.c,v 1.31 1999/05/02 00:18:31 thorpej Exp $  */
+/*     $NetBSD: union_subr.c,v 1.32 1999/06/25 19:05:49 perseant Exp $ */
 
 /*
  * Copyright (c) 1994 Jan-Simon Pendry
@@ -652,6 +652,7 @@
 {
        int error;
        struct vnode *lvp, *uvp;
+       struct vattr lvattr, uvattr;
 
        error = union_vn_create(&uvp, un, p);
        if (error)
@@ -669,11 +670,21 @@
                 * from VOP_CLOSE
                 */
                vn_lock(lvp, LK_EXCLUSIVE | LK_RETRY);
-               error = VOP_OPEN(lvp, FREAD, cred, p);
+
+               error = VOP_GETATTR(lvp, &lvattr, cred, p);
+               if (error == 0)
+                       error = VOP_OPEN(lvp, FREAD, cred, p);
                if (error == 0) {
                        error = union_copyfile(lvp, uvp, cred, p);
                        (void) VOP_CLOSE(lvp, FREAD, cred, p);
                }
+               if (error == 0) {
+                       /* Copy permissions up too */
+                       VATTR_NULL(&uvattr);
+                       uvattr.va_mode = lvattr.va_mode;
+                       uvattr.va_flags = lvattr.va_flags;
+                       error = VOP_SETATTR(uvp, &uvattr, cred, p);
+               }
                VOP_UNLOCK(lvp, 0);
 #ifdef UNION_DIAGNOSTIC
                if (error == 0)



Home | Main Index | Thread Index | Old Index