Re: rmdir of one's pwd (was Re: rmdir of a busy directory)

Andreas Schwab (schwab@issan.informatik.uni-dortmund.de)
12 Feb 1999 14:41:10 +0100


Alexander Viro <viro@math.psu.edu> writes:

|> --- fs/namei.c Tue Feb 9 10:17:15 1999
|> +++ fs/namei.c.new Fri Feb 12 07:46:04 1999
|> @@ -942,6 +942,9 @@
|> if (error)
|> return error;
|>
|> + if (dentry == current->fs->pwd)
|> + return -EINVAL;
|> +
|> if (!dir->i_op || !dir->i_op->rmdir)
|> return -EPERM;

This patch is wrong, it also forbids `rmdir ../foo'. Only a path ending
in '.' is special. Think about it: to find out the real name of the entry
to unlink you'll have find its link in the parent directory. With `.' you
simply don't have enough information about what to unlink.

|> Linus, could you apply this patch? IMHO it makes sense - it
|> explicitly forbids rmdir of one's pwd.

That doesn't make sense at all. The current process's pwd is in no way
special.

-- 
Andreas Schwab                                      "And now for something
schwab@issan.cs.uni-dortmund.de                      completely different"
schwab@gnu.org

- 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/