Re: [RFC] Bug in mkdir(2)

Alexander Viro (viro@math.psu.edu)
Wed, 16 Jun 1999 14:25:00 -0400 (EDT)


On Wed, 16 Jun 1999, Linus Torvalds wrote:

>
>
> On Wed, 16 Jun 1999, Alexander Viro wrote:
> >
> > In other words, if foo is a dangling symlink mkdir("foo/") will merrily
> > follow it. Which it shouldn't.
>
> Why? I think the follows symlink behaviour is the right one, and is
> consistent with "open" etc. Are there any pressing reasons to not do it?

The same as for mkdir("foo")? mkdir behaves like open( ,O_CREAT|O_EXCL, );
Which doesn't follow links, by exactly the same reasons. Think of
ln -sf <something_interesting_that_should_not_exist> /tmp/foo012345
when root-owned process is expected to create/mkdir/mknod/rename to
/tmp/foo12345.

Just to clarify: mkdir("foo") doesn't follow the link. mkdir("foo/") does.

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