Page MenuHomeFreeBSD

D49717.id153371.diff
No OneTemporary

D49717.id153371.diff

diff --git a/lib/libsys/fhopen.2 b/lib/libsys/fhopen.2
--- a/lib/libsys/fhopen.2
+++ b/lib/libsys/fhopen.2
@@ -74,7 +74,9 @@
.Xr open 2
system call.
All said flags are valid except for
-.Dv O_CREAT .
+.Dv O_CREAT
+and
+.Dv O_PATH .
.Pp
The
.Fn fhstat
@@ -113,9 +115,7 @@
.It Bq Er EINVAL
Calling
.Fn fhopen
-with
-.Dv O_CREAT
-set.
+with invalid flags set.
.It Bq Er ESTALE
The file handle
.Fa fhp
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -4663,7 +4663,8 @@
indx = -1;
fmode = FFLAGS(flags);
/* why not allow a non-read/write open for our lockd? */
- if (((fmode & (FREAD | FWRITE)) == 0) || (fmode & O_CREAT))
+ if ((fmode & (FREAD | FWRITE)) == 0 || (fmode & O_CREAT) != 0 ||
+ (fmode & O_PATH) != 0)
return (EINVAL);
error = copyin(u_fhp, &fhp, sizeof(fhp));
if (error != 0)
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -432,6 +432,9 @@
accmode_t accmode;
int error;
+ KASSERT((fmode & O_PATH) == 0 || (fmode & O_ACCMODE) == 0,
+ ("%s: O_PATH and O_ACCMODE are mutually exclusive", __func__));
+
if (vp->v_type == VLNK) {
if ((fmode & O_PATH) == 0 || (fmode & FEXEC) != 0)
return (EMLINK);

File Metadata

Mime Type
text/plain
Expires
Sat, Aug 15, 7:53 PM (5 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
36795394
Default Alt Text
D49717.id153371.diff (1 KB)

Event Timeline