svn commit: r200273 - head/sys/kern
Edward Tomasz Napierala
trasz at FreeBSD.org
Tue Dec 8 12:47:10 PST 2009
Author: trasz
Date: Tue Dec 8 20:47:10 2009
New Revision: 200273
URL: http://svn.freebsd.org/changeset/base/200273
Log:
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
Modified:
head/sys/kern/vfs_syscalls.c
head/sys/kern/vfs_vnops.c
Modified: head/sys/kern/vfs_syscalls.c
==============================================================================
--- head/sys/kern/vfs_syscalls.c Tue Dec 8 20:18:54 2009 (r200272)
+++ head/sys/kern/vfs_syscalls.c Tue Dec 8 20:47:10 2009 (r200273)
@@ -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);
Modified: head/sys/kern/vfs_vnops.c
==============================================================================
--- head/sys/kern/vfs_vnops.c Tue Dec 8 20:18:54 2009 (r200272)
+++ head/sys/kern/vfs_vnops.c Tue Dec 8 20:47:10 2009 (r200273)
@@ -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);
More information about the svn-src-all
mailing list