summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1999-05-15 17:54:58 +0000
committerRoland McGrath <roland@gnu.org>1999-05-15 17:54:58 +0000
commit2d4602af10d7f525b2e1dbafe322c20a62302c6b (patch)
treea76c8d303b6860b71d8c33937ae08d017d19fa25
parenta286867880cd5f30400b9918eb4fe142fcfd0836 (diff)
1999-05-13 Roland McGrath <roland@baalperazim.frob.com>
* file-chown.c (diskfs_S_file_chown): Either arg being -1 means don't change that id.
-rw-r--r--libdiskfs/file-chown.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/libdiskfs/file-chown.c b/libdiskfs/file-chown.c
index 80477eb8..a0007caf 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, 1996 Free Software Foundation
+ Copyright (C) 1992, 1993, 1994, 1996, 1999 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,15 +24,20 @@ diskfs_S_file_chown (struct protid *cred,
uid_t uid,
gid_t gid)
{
+ if (uid == (uid_t) -1 && gid == (gid_t) -1) /* No change requested. */
+ return 0;
+
CHANGE_NODE_FIELD (cred,
({
err = fshelp_isowner (&np->dn_stat, cred->user);
if (err
- || ((!idvec_contains (cred->user->uids, uid)
- || !idvec_contains (cred->user->gids, gid))
+ || (((uid != (uid_t) -1
+ && !idvec_contains (cred->user->uids, uid))
+ || (gid != (gid_t) -1
+ && !idvec_contains (cred->user->gids, gid)))
&& !idvec_contains (cred->user->uids, 0)))
err = EPERM;
- else
+ else
{
err = diskfs_validate_owner_change (np, uid);
if (!err)
@@ -45,8 +50,8 @@ diskfs_S_file_chown (struct protid *cred,
np->dn_stat.st_author = uid;
np->dn_set_ctime = 1;
if (np->filemod_reqs)
- diskfs_notice_filechange(np,
- FILE_CHANGED_META,
+ diskfs_notice_filechange(np,
+ FILE_CHANGED_META,
0, 0);
}
}