summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_extattr.c
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>1999-08-04 04:52:18 +0000
committerimp <imp@FreeBSD.org>1999-08-04 04:52:18 +0000
commit54b72818fb6a387f752eaac619145951eecebb66 (patch)
tree91f15a309ab41e17919927f35eca31b6ee90cde6 /sys/kern/vfs_extattr.c
parent9e1a007dbf407fe2b5b22c6416a08a5b7656369a (diff)
downloadFreeBSD-src-54b72818fb6a387f752eaac619145951eecebb66.zip
FreeBSD-src-54b72818fb6a387f752eaac619145951eecebb66.tar.gz
o Typo in prior version kept it from compiling (blush).
Noticed by: Nobody! o Add comment about why we restrict chflags to root for devices. o nit noticed by bde wrt return values.
Diffstat (limited to 'sys/kern/vfs_extattr.c')
-rw-r--r--sys/kern/vfs_extattr.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c
index cf096f1..3617bfd 100644
--- a/sys/kern/vfs_extattr.c
+++ b/sys/kern/vfs_extattr.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
- * $Id: vfs_syscalls.c,v 1.126 1999/08/02 21:34:46 imp Exp $
+ * $Id: vfs_syscalls.c,v 1.127 1999/08/03 17:07:04 imp Exp $
*/
/* For 4.3 integer FS ID compatibility */
@@ -1893,11 +1893,14 @@ setfflags(p, vp, flags)
struct vattr vattr;
/*
- * Don't allow setting of flags on devices for non-root users.
+ * Prevent non-root users from setting flags on devices. When
+ * a device is reused, users can retain ownership of the device
+ * if they are allowed to set flags and programs assume that
+ * chown can't fail when done as root.
*/
- if ((vp->va_type == VCHR || vp->va_type == VBLK) &&
- (error = suser_xxx(p->ucred, p, PRISON_ROOT)))
- return error;
+ if ((vp->v_type == VCHR || vp->v_type == VBLK) &&
+ ((error = suser_xxx(p->p_ucred, p, PRISON_ROOT)) != 0))
+ return (error);
VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
@@ -1905,7 +1908,7 @@ setfflags(p, vp, flags)
vattr.va_flags = flags;
error = VOP_SETATTR(vp, &vattr, p->p_ucred, p);
VOP_UNLOCK(vp, 0, p);
- return error;
+ return (error);
}
/*
OpenPOWER on IntegriCloud