Date: Mon, 20 Nov 2017 21:38:24 +0000 (UTC) From: Conrad Meyer <cem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r326031 - head/sys/fs/msdosfs Message-ID: <201711202138.vAKLcOxL080933@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: cem Date: Mon Nov 20 21:38:24 2017 New Revision: 326031 URL: https://svnweb.freebsd.org/changeset/base/326031 Log: msdosfs(5): Reflect READONLY attribute in file mode Msdosfs allows setting READONLY by clearing the owner write bit of the file mode. (While here, correct the misspelling of S_IWUSR as VWRITE. No functional change.) In msdosfs_getattr, intuitively reflect that READONLY attribute to userspace in the file mode. Reported by: Karl Denninger <karl AT denninger.net> Sponsored by: Dell EMC Isilon Modified: head/sys/fs/msdosfs/msdosfs_vnops.c Modified: head/sys/fs/msdosfs/msdosfs_vnops.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_vnops.c Mon Nov 20 20:55:41 2017 (r326030) +++ head/sys/fs/msdosfs/msdosfs_vnops.c Mon Nov 20 21:38:24 2017 (r326031) @@ -287,6 +287,8 @@ msdosfs_getattr(struct vop_getattr_args *ap) vap->va_fileid = fileid; mode = S_IRWXU|S_IRWXG|S_IRWXO; + if (dep->de_Attributes & ATTR_READONLY) + mode &= ~(S_IWUSR|S_IWGRP|S_IWOTH); vap->va_mode = mode & (ap->a_vp->v_type == VDIR ? pmp->pm_dirmask : pmp->pm_mask); vap->va_uid = pmp->pm_uid; @@ -502,7 +504,7 @@ msdosfs_setattr(struct vop_setattr_args *ap) } if (vp->v_type != VDIR) { /* We ignore the read and execute bits. */ - if (vap->va_mode & VWRITE) + if (vap->va_mode & S_IWUSR) dep->de_Attributes &= ~ATTR_READONLY; else dep->de_Attributes |= ATTR_READONLY;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201711202138.vAKLcOxL080933>