svn commit: r234929 - in stable/9/sys: i386/conf kern ufs/ufs

Jaakko Heinonen jh at FreeBSD.org
Wed May 2 15:15:29 UTC 2012


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);
 	/*


More information about the svn-src-stable-9 mailing list