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:
parent
e888c6f864
commit
110b737502
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user