diff options
author | Michael I. Bushnell <mib@gnu.org> | 1995-12-14 20:51:17 +0000 |
---|---|---|
committer | Michael I. Bushnell <mib@gnu.org> | 1995-12-14 20:51:17 +0000 |
commit | c12ff89783ecec965ea01abc7fb097abdec25d6d (patch) | |
tree | c750d718d6162583e017e9f4779b71c186733004 | |
parent | 7eed8cd21310c35405a775396eff798b3b2d74e0 (diff) |
(diskfs_checkdirmod): Correctly return error code for failure, not 1.
-rw-r--r-- | libdiskfs/diskfs.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/libdiskfs/diskfs.h b/libdiskfs/diskfs.h index 2b874178..3d5650aa 100644 --- a/libdiskfs/diskfs.h +++ b/libdiskfs/diskfs.h @@ -777,12 +777,20 @@ extern inline error_t diskfs_checkdirmod (struct node *dp, struct node *np, struct protid *cred) { + error_t err; + /* The user must be able to write the directory, but if the directory is sticky, then the user must also be either the owner of the directory or the file. */ - return (diskfs_access (dp, S_IWRITE, cred) - && (!(dp->dn_stat.st_mode & S_ISVTX) || !np || diskfs_isuid (0,cred) - || diskfs_isowner (dp, cred) || diskfs_isowner (np, cred))); + err = diskfs_access (dp, S_IWRITE, cred); + if (err) + return err; + + if ((dp->dn_stat.st_mode & S_ISVTX) && np && !diskfs_isuid (0, cred) + && !diskfs_isowner (dp, cred) && !diskfs_isowner (np, cred)) + return EACCES; + + return 0; } /* Reading and writing of files. this is called by other filesystem |