]> git.hungrycats.org Git - linux/commitdiff
[PATCH] ATTR_MODE breakage
authorAlexander Viro <viro@math.psu.edu>
Wed, 1 May 2002 05:26:24 +0000 (22:26 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Wed, 1 May 2002 05:26:24 +0000 (22:26 -0700)
(originally caught by Paul Larson <plars@austin.ibm.com>)

Patch fixes a couple of idiotic bugs in notify_change() (my
fault).  Unary operations have higher priority than binary ones, so
if (!valid & ATTR_MODE) doesn't do the right thing.  I plead temporary
braindamage...

fs/attr.c

index f065ba5653390b04d1359c0a9680f31293ff1b86..7e9d65feaa832053d2e96e7e3b98332f932642e7 100644 (file)
--- a/fs/attr.c
+++ b/fs/attr.c
@@ -134,7 +134,7 @@ int notify_change(struct dentry * dentry, struct iattr * attr)
                attr->ia_mtime = now;
        if (ia_valid & ATTR_KILL_SUID) {
                if (mode & S_ISUID) {
-                       if (!ia_valid & ATTR_MODE) {
+                       if (!(ia_valid & ATTR_MODE)) {
                                ia_valid = attr->ia_valid |= ATTR_MODE;
                                attr->ia_mode = inode->i_mode;
                        }
@@ -143,7 +143,7 @@ int notify_change(struct dentry * dentry, struct iattr * attr)
        }
        if (ia_valid & ATTR_KILL_SGID) {
                if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) {
-                       if (!ia_valid & ATTR_MODE) {
+                       if (!(ia_valid & ATTR_MODE)) {
                                ia_valid = attr->ia_valid |= ATTR_MODE;
                                attr->ia_mode = inode->i_mode;
                        }