Subject: setmode(3) fixes
To: None <current-users@sun-lamp.cs.berkeley.edu>
From: None <Mark_Weaver@brown.edu>
List: current-users
Date: 02/10/1994 05:22:23
There were some bugs in setmode(3) that prevented chmod(1) from
working correctly.  The first hunk is questionable, but is based
on my interpretation of the manpage.  The second hunk is definitely
necessary, or else "chmod g=u file" doesn't work correctly.

	Mark
--------------------------------------------------------------------
Email: Mark_Weaver@brown.edu           | Brown University
PGP Key: finger mhw@cs.brown.edu       | Dept of Computer Science


diff -c  src/lib/libc/gen/setmode.c.mhw1 src/lib/libc/gen/setmode.c
*** src/lib/libc/gen/setmode.c.mhw1	Tue Jan  4 06:02:34 1994
--- src/lib/libc/gen/setmode.c	Thu Feb 10 05:08:05 1994
***************
*** 180,186 ****
  			set->bits = ~0;
  		} else {
  			set->cmd2 = CMD2_UBITS | CMD2_GBITS | CMD2_OBITS;
! 			set->bits = mask;
  		}
  	
  		if (oparg == '+')
--- 180,187 ----
  			set->bits = ~0;
  		} else {
  			set->cmd2 = CMD2_UBITS | CMD2_GBITS | CMD2_OBITS;
! 			set->bits = ((oparg == '-') ?
! 				     (S_IRWXU|S_IRWXG|S_IRWXO) : mask);
  		}
  	
  		if (oparg == '+')
***************
*** 330,337 ****
  					ADDCMD('X', who, permXbits, mask);
  					permXbits = 0;
  				}
! 				ADDCMD(*p, who, op, mask);
! 				break;
  
  			default:
  				/*
--- 331,338 ----
  					ADDCMD('X', who, permXbits, mask);
  					permXbits = 0;
  				}
! 				ADDCMD(*p++, who, op, mask);
! 				goto apply;
  
  			default:
  				/*

------------------------------------------------------------------------------