Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Fix confusion arising from whether FOLLOW or NOFOLL...



details:   https://anonhg.NetBSD.org/src/rev/639a32c1f14a
branches:  trunk
changeset: 984706:639a32c1f14a
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sun Jul 18 09:30:36 2021 +0000

description:
Fix confusion arising from whether FOLLOW or NOFOLLOW is 0.

In vn_open, don't set and then throw away FOLLOW, and clarify the
comment about requesting FOLLOW/NOFOLLOW behavior.

Related to PR 56316.

diffstat:

 sys/kern/vfs_vnops.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (39 lines):

diff -r 79740ac11756 -r 639a32c1f14a sys/kern/vfs_vnops.c
--- a/sys/kern/vfs_vnops.c      Sun Jul 18 07:22:22 2021 +0000
+++ b/sys/kern/vfs_vnops.c      Sun Jul 18 09:30:36 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_vnops.c,v 1.220 2021/07/01 15:53:20 martin Exp $   */
+/*     $NetBSD: vfs_vnops.c,v 1.221 2021/07/18 09:30:36 dholland Exp $ */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.220 2021/07/01 15:53:20 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.221 2021/07/18 09:30:36 dholland Exp $");
 
 #include "veriexec.h"
 
@@ -155,8 +155,9 @@
  * EOPNOTSUPP will be produced in the cases that would otherwise return
  * a file descriptor.
  *
- * Note that callers that want NOFOLLOW should pass O_NOFOLLOW in fmode,
- * not NOFOLLOW in nmode.
+ * Note that callers that want no-follow behavior should pass
+ * O_NOFOLLOW in fmode. Neither FOLLOW nor NOFOLLOW in nmode is
+ * honored.
  */
 int
 vn_open(struct vnode *at_dvp, struct pathbuf *pb,
@@ -179,7 +180,7 @@
        if ((fmode & (O_CREAT | O_DIRECTORY)) == (O_CREAT | O_DIRECTORY))
                return EINVAL;
 
-       NDINIT(&nd, LOOKUP, FOLLOW | nmode, pb);
+       NDINIT(&nd, LOOKUP, nmode, pb);
        if (at_dvp != NULL)
                NDAT(&nd, at_dvp);
 



Home | Main Index | Thread Index | Old Index