[patch] rm can have undesired side-effects

LI Xin delphij at delphij.net
Mon Oct 30 03:42:06 UTC 2006


Joerg Pernfuss wrote:
> On Mon, 30 Oct 2006 02:43:58 +0100
> Joerg Pernfuss <elessar at bsdforen.de> wrote:
> 
>> That would mean that `rm -P <file>' with <file> having a link count of
>> at least 2, would behave like `rm <file>' (and like Romain suggested).
> 
> 
> Correction after some `read the frakkin code':
> 
> if (sbp->st_nlink > 1) {
> 		warnx("%s (inode %u): not overwritten due to multiple links",
> 		    file, sbp->st_ino);
> 		return (0);
> The link is removed, the file is not overwritten and a warning is generated.

Yeah I think this is reasonable and thanks y'all for mentioning this.

I have just committed a similar patch that is ported from OpenBSD
against -HEAD.

Cheers,
-- 
Xin LI <delphij at delphij.net>	http://www.delphij.net/
FreeBSD - The Power to Serve!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20061030/490d6f66/signature.pgp


More information about the freebsd-hackers mailing list