Module Name: src
Committed By: dholland
Date: Sun Jul 18 09:30:36 UTC 2021
Modified Files:
src/sys/kern: vfs_vnops.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.220 -r1.221 src/sys/kern/vfs_vnops.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/vfs_vnops.c
diff -u src/sys/kern/vfs_vnops.c:1.220 src/sys/kern/vfs_vnops.c:1.221
--- src/sys/kern/vfs_vnops.c:1.220 Thu Jul 1 15:53:20 2021
+++ src/sys/kern/vfs_vnops.c Sun Jul 18 09:30:36 2021
@@ -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 @@ const struct fileops vnops = {
* 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 @@ vn_open(struct vnode *at_dvp, struct pat
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);