From owner-svn-src-stable@FreeBSD.ORG Wed May 2 15:15:29 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18DA7106566C; Wed, 2 May 2012 15:15:29 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DCFCE8FC16; Wed, 2 May 2012 15:15:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q42FFS4A090724; Wed, 2 May 2012 15:15:28 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q42FFS1O090722; Wed, 2 May 2012 15:15:28 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201205021515.q42FFS1O090722@svn.freebsd.org> From: Jaakko Heinonen Date: Wed, 2 May 2012 15:15:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r234929 - in stable/9/sys: i386/conf kern ufs/ufs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 May 2012 15:15:29 -0000 Author: jh Date: Wed May 2 15:15:28 2012 New Revision: 234929 URL: http://svn.freebsd.org/changeset/base/234929 Log: MFC r233787: - Use more natural ip->i_flags instead of vap->va_flags in the final flags check. - Add a comment for the immutable/append check done after handling of the flags. - Style improvements. No functional change intended. MFC r234421: The part about exec atime no longer applies in the comment. Modified: stable/9/sys/ufs/ufs/ufs_vnops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) stable/9/sys/kern/subr_witness.c (props changed) Modified: stable/9/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- stable/9/sys/ufs/ufs/ufs_vnops.c Wed May 2 14:38:43 2012 (r234928) +++ stable/9/sys/ufs/ufs/ufs_vnops.c Wed May 2 15:15:28 2012 (r234929) @@ -547,8 +547,8 @@ ufs_setattr(ap) * processes. */ if (!priv_check_cred(cred, PRIV_VFS_SYSFLAGS, 0)) { - if (ip->i_flags - & (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND)) { + if (ip->i_flags & + (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND)) { error = securelevel_gt(cred, 0); if (error) return (error); @@ -562,8 +562,8 @@ ufs_setattr(ap) ip->i_flags = vap->va_flags; DIP_SET(ip, i_flags, vap->va_flags); } else { - if (ip->i_flags - & (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND) || + if (ip->i_flags & + (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND) || (vap->va_flags & UF_SETTABLE) != vap->va_flags) return (EPERM); ip->i_flags &= SF_SETTABLE; @@ -572,9 +572,14 @@ ufs_setattr(ap) } ip->i_flag |= IN_CHANGE; error = UFS_UPDATE(vp, 0); - if (vap->va_flags & (IMMUTABLE | APPEND)) + if (ip->i_flags & (IMMUTABLE | APPEND)) return (error); } + /* + * If immutable or append, no one can change any of its attributes + * except the ones already handled (in some cases, file flags + * including the immutability flags themselves for the superuser). + */ if (ip->i_flags & (IMMUTABLE | APPEND)) return (EPERM); /*