summaryrefslogtreecommitdiff
path: root/libdiskfs/file-chown.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1999-05-16 15:50:05 +0000
committerRoland McGrath <roland@gnu.org>1999-05-16 15:50:05 +0000
commit2ac477fac6009078fb09c3798896a4040077bab9 (patch)
treec34efc374b60f0931812614fa36aa4685d3038a6 /libdiskfs/file-chown.c
parent6bc8435f1574fdda9bf089ae21a7af198868814d (diff)
1999-05-16 Roland McGrath <roland@baalperazim.frob.com>
* file-chown.c (diskfs_S_file_chown): Fix last change: not just permission check, actually don't make the change if value is -1.
Diffstat (limited to 'libdiskfs/file-chown.c')
-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 a0007caf..ecb851f2 100644
--- a/libdiskfs/file-chown.c
+++ b/libdiskfs/file-chown.c
@@ -39,15 +39,20 @@ diskfs_S_file_chown (struct protid *cred,
err = EPERM;
else
{
- err = diskfs_validate_owner_change (np, uid);
- if (!err)
+ if (uid != (uid_t) -1)
+ err = diskfs_validate_owner_change (np, uid);
+ if (!err && gid != (gid_t) -1)
err = diskfs_validate_group_change (np, gid);
if (!err)
{
- np->dn_stat.st_uid = uid;
- np->dn_stat.st_gid = gid;
- if (np->author_tracks_uid)
- np->dn_stat.st_author = uid;
+ if (uid != (uid_t) -1)
+ {
+ np->dn_stat.st_uid = uid;
+ if (np->author_tracks_uid)
+ np->dn_stat.st_author = uid;
+ }
+ if (gid != (gid_t) -1)
+ np->dn_stat.st_gid = gid;
np->dn_set_ctime = 1;
if (np->filemod_reqs)
diskfs_notice_filechange(np,