summaryrefslogtreecommitdiff
path: root/libdiskfs/file-chown.c
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1995-03-17 18:57:29 +0000
committerMichael I. Bushnell <mib@gnu.org>1995-03-17 18:57:29 +0000
commit9d0d90c6aab0a7763e0a8576b964601042e33270 (patch)
tree600c56701dd37ec11b477f9e2d59eb4b95c05789 /libdiskfs/file-chown.c
parent3cf17d30fac99853c5324167d35ba4db667cd819 (diff)
Back out previous change.
Diffstat (limited to 'libdiskfs/file-chown.c')
-rw-r--r--libdiskfs/file-chown.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/libdiskfs/file-chown.c b/libdiskfs/file-chown.c
index 58ea51cf..c0f685c7 100644
--- a/libdiskfs/file-chown.c
+++ b/libdiskfs/file-chown.c
@@ -1,5 +1,5 @@
/* libdiskfs implementetation of fs.defs: file_chown
- Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation
+ Copyright (C) 1992, 1993, 1994 Free Software Foundation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -24,24 +24,15 @@ diskfs_S_file_chown (struct protid *cred,
uid_t uid,
gid_t gid)
{
- struct userid *id;
-
CHANGE_NODE_FIELD (cred,
({
err = diskfs_isowner (np, cred);
- if (!err)
- {
- assert (cred->id);
- for (id = cred->id; id && !err; id = id->next)
- {
- if (diskfs_idhasuid (0, id))
- continue;
- if (!diskfs_idhasuid (uid, cred)
- || !diskfs_idhasgid (gid, cred))
- err = EPERM;
- }
- }
- if (!err)
+ if (err
+ || ((!diskfs_isuid (uid, cred)
+ || !diskfs_groupmember (gid, cred))
+ && !diskfs_isuid (0, cred)))
+ err = EPERM;
+ else
{
np->dn_stat.st_uid = uid;
np->dn_stat.st_gid = gid;