Follow the ufs practice for disallowing permission changes as well as

writes to files for read-only file systems. Since there are already
checks in nandfs_setattr that return an error, this moves detection of
the error earlier.
This commit is contained in:
imp 2014-08-02 05:05:10 +00:00
parent 57758616d2
commit 30d213fa5d

View File

@ -987,7 +987,7 @@ nandfs_check_possible(struct vnode *vp, struct vattr *vap, mode_t mode)
* Normal nodes: check if we're on a read-only mounted
* filingsystem and bomb out if we're trying to write.
*/
if ((mode & VWRITE) && (vp->v_mount->mnt_flag & MNT_RDONLY))
if ((mode & VMODIFY_PERMS) && (vp->v_mount->mnt_flag & MNT_RDONLY))
return (EROFS);
break;
case VBLK: