From 2ac477fac6009078fb09c3798896a4040077bab9 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sun, 16 May 1999 15:50:05 +0000 Subject: 1999-05-16 Roland McGrath * file-chown.c (diskfs_S_file_chown): Fix last change: not just permission check, actually don't make the change if value is -1. --- libdiskfs/file-chown.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'libdiskfs') 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, -- cgit v1.2.3