summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2010-03-21 20:43:23 +0000
committered <ed@FreeBSD.org>2010-03-21 20:43:23 +0000
commit61565034678feb77b6c58414a124a3e2da5b51e7 (patch)
treebd53b22130f2318dc178cfea963b4c5affe6d99a /sys/kern
parentef7941cba28fcad604cef37d54a4b24af415b5f2 (diff)
downloadFreeBSD-src-61565034678feb77b6c58414a124a3e2da5b51e7.zip
FreeBSD-src-61565034678feb77b6c58414a124a3e2da5b51e7.tar.gz
Actually make O_DIRECTORY work.
According to POSIX open() must return ENOTDIR when the path name does not refer to a path name. Change vn_open() to respect this flag. This also simplifies the Linuxolator a bit.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/vfs_syscalls.c4
-rw-r--r--sys/kern/vfs_vnops.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 9d535b5..bcc3cbb 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -4428,6 +4428,10 @@ fhopen(td, uap)
error = EOPNOTSUPP;
goto bad;
}
+ if (vp->v_type != VDIR && fmode & O_DIRECTORY) {
+ error = ENOTDIR;
+ goto bad;
+ }
accmode = 0;
if (fmode & (FWRITE | O_TRUNC)) {
if (vp->v_type == VDIR) {
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index d0b713c..a16fa67 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -200,6 +200,10 @@ restart:
error = EOPNOTSUPP;
goto bad;
}
+ if (vp->v_type != VDIR && fmode & O_DIRECTORY) {
+ error = ENOTDIR;
+ goto bad;
+ }
accmode = 0;
if (fmode & (FWRITE | O_TRUNC)) {
if (vp->v_type == VDIR) {
OpenPOWER on IntegriCloud