summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2009-12-08 20:47:10 +0000
committertrasz <trasz@FreeBSD.org>2009-12-08 20:47:10 +0000
commit110b737502be5dc3e6b90301262ce0c02959c7d3 (patch)
tree141d0f8528a9617bb8ab6debc1fae114c16b39f4 /sys/kern
parente888c6f864ef40440287949376c4e869a07f8b68 (diff)
downloadFreeBSD-src-110b737502be5dc3e6b90301262ce0c02959c7d3.zip
FreeBSD-src-110b737502be5dc3e6b90301262ce0c02959c7d3.tar.gz
Don't add VAPPEND if the file is not being opened for writing. Note that this
only affects cases where open(2) is being used improperly - i.e. when the user specifies O_APPEND without O_WRONLY or O_RDWR. Reviewed by: rwatson
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/vfs_syscalls.c2
-rw-r--r--sys/kern/vfs_vnops.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 0a8ef46..eb5fb87 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -4426,7 +4426,7 @@ fhopen(td, uap)
}
if (fmode & FREAD)
accmode |= VREAD;
- if (fmode & O_APPEND)
+ if ((fmode & O_APPEND) && (fmode & FWRITE))
accmode |= VAPPEND;
#ifdef MAC
error = mac_vnode_check_open(td->td_ucred, vp, accmode);
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index 03e8d93..d0b713c 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -212,7 +212,7 @@ restart:
accmode |= VREAD;
if (fmode & FEXEC)
accmode |= VEXEC;
- if (fmode & O_APPEND)
+ if ((fmode & O_APPEND) && (fmode & FWRITE))
accmode |= VAPPEND;
#ifdef MAC
error = mac_vnode_check_open(cred, vp, accmode);
OpenPOWER on IntegriCloud