Re: [PATCH]Fix bug:rmdir could remove current working directory

Mingming cao (cmm@us.ibm.com)
Wed, 10 Oct 2001 17:02:53 -1000


Linus Torvalds wrote:
>
> In article <3BC4EFFC.42ACE59E@us.ibm.com>,
> Mingming cao <cmm@us.ibm.com> wrote:
> >
> >I thought about the case when rmdir() on the cwd of other processes,
> >but, as you said, that is implementation dependent. However rmdir() on
> >"." does returns EBUSY error.
>
> That's a completely different thing, though - even though the difference
> is rather subtle.
>
> You can remove pretty much any empty directory (if the filesystem
> permits it - some don't). HOWEVER, you can not use "." as the final
> component of your pathname.
>
> It has nothing to do with home directory: you can try just doing
>
> mkdir /tmp/hello
> rmdir /tmp/hello/.
>
> and you'll get the same error (and it _should_ return EINVAL, not EBUSY.
> EBUSY is for the "this filesystem doesn't allow you to remove a
> directory that is in use" case).
>
> Linus

I misunderstanded the rule. Thanks for clarifying!

-- 
Mingming Cao
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/