svn commit: r326031 - head/sys/fs/msdosfs
Conrad Meyer
cem at FreeBSD.org
Mon Nov 20 21:38:25 UTC 2017
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;
More information about the svn-src-all
mailing list