[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Renaming read-only files



To: mint@atari.archive.umich.edu

Yo.

I was about to start using rcs again, when I realized that an old patch
(~mint-1.09.something) has not made it into the newer releases.
The trouble are with renaming read-only files. As it is now, this is
illegal, and rcs fails. So, I introduce this little patch, which enables
the super-user or the owner of a file to rename it - even if it is
write-protected.

--------------- 8< ----- snippe-ti-snip ----- 8< ---------------
*** orig-dosdir.c	Sun Aug 14 16:49:32 1994
--- dosdir.c	Fri Sep  9 00:02:02 1994
***************
*** 827,833 ****
  	r = (*oldfil.fs->getxattr)(&oldfil, &xattr);
  	release_cookie(&oldfil);
  	if (r ||
! 	    ((xattr.mode & S_IFMT) == S_IFREG && (xattr.attr & FA_RDONLY)) )
  	{
  		DEBUG(("Frename(%s,%s): access to old file not granted",old,new));
  		release_cookie(&olddir);
--- 827,836 ----
  	r = (*oldfil.fs->getxattr)(&oldfil, &xattr);
  	release_cookie(&oldfil);
  	if (r ||
! 	    ((xattr.mode & S_IFMT) == S_IFREG &&
! 	     ((xattr.attr & FA_RDONLY)&&curproc->euid&&(curproc->euid!=xattr.uid)) ))
! 	       /* Only SouperUser and the owner of the file are allowed to rename
! 		  readonly files */
  	{
  		DEBUG(("Frename(%s,%s): access to old file not granted",old,new));
  		release_cookie(&olddir);
--------------- 8< ----- snappe-ti-snap ----- 8< ---------------

Erling   
---
 ~ ATP/Unix 1.40 ~ This is my tagline.