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
259100de20
commit
9d7031a6d6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=200273
@ -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 @@ vn_open_cred(struct nameidata *ndp, int *flagp, int cmode, u_int vn_open_flags,
|
||||
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…
Reference in New Issue
Block a user