MFC r200273:

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
This commit is contained in:
Edward Tomasz Napierala 2010-03-27 18:09:40 +00:00
parent 89a2dbabba
commit bf876fcd34
2 changed files with 2 additions and 2 deletions

View File

@ -4436,7 +4436,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);

View File

@ -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);