Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Oct 2004 02:37:50 +0700
From:      Dmitry Frolov <frolov@riss-telecom.ru>
To:        Giorgos Keramidas <keramida@freebsd.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Protection from the dreaded "rm -fr /"
Message-ID:  <20041002193750.GA19271@nerve.riss-telecom.ru>
In-Reply-To: <20041002090635.GA71050@gothmog.gr>
References:  <20041002081928.GA21439@gothmog.gr> <20041002102918.W22102@fw.reifenberger.com> <20041002085143.GA52519@gothmog.gr> <20041002090635.GA71050@gothmog.gr>

next in thread | previous in thread | raw e-mail | index | archive | help
* Giorgos Keramidas <keramida@freebsd.org> [02.10.2004 16:07]:

> On 2004-10-02 11:51, Giorgos Keramidas <keramida@freebsd.org> wrote:
> > On 2004-10-02 10:34, Michael Reifenberger <mike@reifenberger.com> wrote:
> > >
> > > This does only help for the obvious case of '/' but not for the
> > > './' and '../' or '../../' ... accidents.
> >
> > Hmm, indeed.  This can be fixed, but it might take a little thinking
> > over about ways to implement it without adding too much overhead to the
> > way rm(1) works now.
> 
> One way to do that is to use realpath(3), but I have to ask more
> knowledgeable people about the comment immediately below my change:

Other way that may be cheaper is to stat '/', stat each argument
and then compare device and inode numbers.

    wbr&w, dmitry.
-- 
Dmitry Frolov <frolov@riss-telecom.ru>
RISS-Telecom Network, Novosibirsk, Russia
66415911@ICQ, +7 3832 NO WA1T, DVF-RIPE



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