Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ufs/chfs chfs: uappnd flag patch
details: https://anonhg.NetBSD.org/src/rev/ebb6be6303b2
branches: trunk
changeset: 781159:ebb6be6303b2
user: ttoth <ttoth%NetBSD.org@localhost>
date: Thu Aug 23 11:29:51 2012 +0000
description:
chfs: uappnd flag patch
diffstat:
sys/ufs/chfs/chfs_vnops.c | 37 ++++++++++++++++++++++++++++++-------
1 files changed, 30 insertions(+), 7 deletions(-)
diffs (68 lines):
diff -r c2b359f8fc59 -r ebb6be6303b2 sys/ufs/chfs/chfs_vnops.c
--- a/sys/ufs/chfs/chfs_vnops.c Thu Aug 23 10:48:19 2012 +0000
+++ b/sys/ufs/chfs/chfs_vnops.c Thu Aug 23 11:29:51 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: chfs_vnops.c,v 1.9 2012/08/10 09:26:58 ttoth Exp $ */
+/* $NetBSD: chfs_vnops.c,v 1.10 2012/08/23 11:29:51 ttoth Exp $ */
/*-
* Copyright (c) 2010 Department of Software Engineering,
@@ -467,17 +467,33 @@
return EINVAL;
}
- if (error == 0 && (vap->va_flags != VNOVAL))
+ if (error == 0 && (vap->va_flags != VNOVAL)) {
error = chfs_chflags(vp, vap->va_flags, cred);
+ return error;
+ }
- if (error == 0 && (vap->va_size != VNOVAL))
- error = chfs_chsize(vp, vap->va_size, cred);
+ if (ip->flags & (IMMUTABLE | APPEND)) {
+ error = EPERM;
+ return error;
+ }
- if (error == 0 && (vap->va_uid != VNOVAL || vap->va_gid != VNOVAL))
- error = chfs_chown(vp, vap->va_uid, vap->va_gid, cred);
+ if (error == 0 && (vap->va_size != VNOVAL)) {
+ error = chfs_chsize(vp, vap->va_size, cred);
+ if (error)
+ return error;
+ }
- if (error == 0 && (vap->va_mode != VNOVAL))
+ if (error == 0 && (vap->va_uid != VNOVAL || vap->va_gid != VNOVAL)) {
+ error = chfs_chown(vp, vap->va_uid, vap->va_gid, cred);
+ if (error)
+ return error;
+ }
+
+ if (error == 0 && (vap->va_mode != VNOVAL)) {
error = chfs_chmod(vp, vap->va_mode, cred);
+ if (error)
+ return error;
+ }
#if 0
/* why do we need that? */
@@ -1054,11 +1070,18 @@
struct chfs_inode *parent = VTOI(dvp);
int error = 0;
+ if (vp->v_type == VDIR || (ip->flags & (IMMUTABLE | APPEND)) ||
+ (parent->flags & APPEND)) {
+ error = EPERM;
+ goto out;
+ }
+
KASSERT(ip->chvc->vno != ip->chvc->pvno);
error = chfs_do_unlink(ip,
parent, cnp->cn_nameptr, cnp->cn_namelen);
+out:
vput(dvp);
vput(vp);
Home |
Main Index |
Thread Index |
Old Index