Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Jul 1996 13:50:04 -0700 (PDT)
From:      Garrett Wollman <wollman@lcs.mit.edu>
To:        freebsd-bugs
Subject:   Re: bin/1375: Extraneous warning from mv(1)
Message-ID:  <199607162050.NAA17595@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/1375; it has been noted by GNATS.

From: Garrett Wollman <wollman@lcs.mit.edu>
To: Zach Heilig <zach@blizzard.gaffaneys.com>
Cc: freebsd-gnats-submit@freefall.freebsd.org
Subject: Re: bin/1375: Extraneous warning from mv(1)
Date: Tue, 16 Jul 1996 16:47:57 -0400

 <<On 10 Jul 1996 23:38:48 -0500, Zach Heilig <zach@blizzard.gaffaneys.com> said:
 
 > Garrett Wollman <wollman@lcs.mit.edu> writes:
 >> I think I have a better proposal, which is essentially the same as
 >> Bruce's:
 
 >> 1) If the gid of the directory is in cr_groups[], then use it.
 
 >> 2) Otherwise, use cr_groups[0].
 
 > This is more or less what I was trying to say in my very first
 > message, but perhaps I flubbed it up :-).  
 
 Here is a proposed patch which implements this behavior.
 
 Index: ufs_vnops.c
 ===================================================================
 RCS file: /home/ncvs/src/sys/ufs/ufs/ufs_vnops.c,v
 retrieving revision 1.39
 diff -u -r1.39 ufs_vnops.c
 --- ufs_vnops.c	1996/07/09 16:51:18	1.39
 +++ ufs_vnops.c	1996/07/16 20:45:21
 @@ -1274,7 +1274,10 @@
  		goto out;
  	ip = VTOI(tvp);
  	ip->i_uid = cnp->cn_cred->cr_uid;
 -	ip->i_gid = dp->i_gid;
 +	if (groupmember(dp->i_gid, cnp->cn_cred))
 +		ip->i_gid = dp->i_gid;
 +	else
 +		ip->i_gid = cnp->cn_cred->cr_gid;
  #ifdef QUOTA
  	if ((error = getinoquota(ip)) ||
  	    (error = chkiq(ip, 1, cnp->cn_cred, 0))) {
 @@ -2101,11 +2104,16 @@
  		return (error);
  	}
  	ip = VTOI(tvp);
 -	ip->i_gid = pdir->i_gid;
 -	if ((mode & IFMT) == IFLNK)
 +	if ((mode & IFMT) == IFLNK) {
  		ip->i_uid = pdir->i_uid;
 -	else
 +		ip->i_gid = pdir->i_gid;
 +	} else {
  		ip->i_uid = cnp->cn_cred->cr_uid;
 +		if (groupmember(pdir->i_gid, cnp->cn_cred))
 +			ip->i_gid = pdir->i_gid;
 +		else
 +			ip->i_gid = cnp->cn_cred->cr_gid;
 +	}
  #ifdef QUOTA
  	if ((error = getinoquota(ip)) ||
  	    (error = chkiq(ip, 1, cnp->cn_cred, 0))) {
 
 
 -GAWollman
 
 --
 Garrett A. Wollman   | Shashish is simple, it's discreet, it's brief. ... 
 wollman@lcs.mit.edu  | Shashish is the bonding of hearts in spite of distance.
 Opinions not those of| It is a bond more powerful than absence.  We like people
 MIT, LCS, ANA, or NSA| who like Shashish.  - Claude McKenzie + Florent Vollant



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199607162050.NAA17595>