diff --git a/sys/fs/cd9660/cd9660_vnops.c b/sys/fs/cd9660/cd9660_vnops.c index 33ca58472490..0453b2f68972 100644 --- a/sys/fs/cd9660/cd9660_vnops.c +++ b/sys/fs/cd9660/cd9660_vnops.c @@ -120,7 +120,7 @@ cd9660_access(struct vop_access_args *ap) struct vnode *vp = ap->a_vp; struct iso_node *ip = VTOI(vp); accmode_t accmode = ap->a_accmode; - accmode_t file_mode; + accmode_t file_mode, mask; uid_t uid; gid_t gid; @@ -144,8 +144,9 @@ cd9660_access(struct vop_access_args *ap) } } - file_mode = ip->inode.iso_mode; - file_mode &= (vp->v_type == VDIR) ? ip->i_mnt->im_dmask : ip->i_mnt->im_fmask; + mask = (ALLPERMS & ~ACCESSPERMS) | + (vp->v_type == VDIR) ? ip->i_mnt->im_dmask : ip->i_mnt->im_fmask; + file_mode = ip->inode.iso_mode & mask; uid = (ip->i_mnt->im_flags & ISOFSMNT_UID) ? ip->i_mnt->im_uid : ip->inode.iso_uid; @@ -176,12 +177,14 @@ cd9660_getattr(struct vop_getattr_args *ap) struct vnode *vp = ap->a_vp; struct vattr *vap = ap->a_vap; struct iso_node *ip = VTOI(vp); + mode_t mask; vap->va_fsid = dev2udev(ip->i_mnt->im_dev); vap->va_fileid = ip->i_number; - vap->va_mode = ip->inode.iso_mode; - vap->va_mode &= (vp->v_type == VDIR) ? ip->i_mnt->im_dmask : ip->i_mnt->im_fmask; + mask = (ALLPERMS & ~ACCESSPERMS) | + (vp->v_type == VDIR) ? ip->i_mnt->im_dmask : ip->i_mnt->im_fmask; + vap->va_mode = ip->inode.iso_mode & mask; vap->va_nlink = ip->inode.iso_links; vap->va_uid = (ip->i_mnt->im_flags & ISOFSMNT_UID) ?