Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Nov 2005 09:20:21 GMT
From:      vaidab <vaidab@phenix.rootshell.be>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/88365 : [patch] rm(1): "/bin/rm -P" cannot remove files not writeable by user while "/bin/rm" can
Message-ID:  <200511060920.jA69KLEX032741@freefall.freebsd.org>

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

From: vaidab <vaidab@phenix.rootshell.be>
To: bug-followup@FreeBSD.org
Cc: vaida.bogdan@gmail.com
Subject: Re: bin/88365 : [patch] rm(1): "/bin/rm -P" cannot remove files not
 writeable by user while "/bin/rm" can
Date: Sun, 6 Nov 2005 10:14:07 +0100 (CET)

 I'm submitting the patch again. mx1.freebsd.org rejects me as I don't have 
 a hostname and my send-pr are sent via email
 
 > Fix:
 
 --- /usr/src/bin/rm/rm.c.orig	Thu Nov  3 21:19:47 2005
 +++ /usr/src/bin/rm/rm.c	Thu Nov  3 21:20:42 2005
 @@ -393,6 +393,8 @@
   	}
   	if (!S_ISREG(sbp->st_mode))
   		return (1);
 +	if (lchmod(file, S_IWUSR) == -1)
 +		goto err;
   	if ((fd = open(file, O_WRONLY, 0)) == -1)
   		goto err;
   	if (fstatfs(fd, &fsb) == -1)
 @@ -450,7 +452,7 @@
   		 * we will not be able to overwrite file contents and will
   		 * barf later.
   		 */
 -		if (!stdin_ok || S_ISLNK(sp->st_mode) || Pflag ||
 +		if (!stdin_ok || S_ISLNK(sp->st_mode) ||
   		    (!access(name, W_OK) &&
   		    !(sp->st_flags & (SF_APPEND|SF_IMMUTABLE)) &&
   		    (!(sp->st_flags & (UF_APPEND|UF_IMMUTABLE)) || !uid)))



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