[PATCH] use S_ISDIR() in link_path_walk() to decide whether the last path component is a directory

From: Alex Zarochentsev
Date: Mon Sep 13 2004 - 03:01:31 EST


Hi,

This patch does not allow open(name, O_DIRECTORY) to be successful for
non-directories in reiser4. It replaces ->i_op->lookup != NULL "is dir" check
for the last path component by explicit S_ISDIR(->i_mode) check.

Regardless to reiser4, S_ISDIR() looks more clear there.

Thanks in advance.

===== fs/namei.c 1.104 vs edited =====
--- 1.104/fs/namei.c Tue Aug 10 16:59:38 2004
+++ edited/fs/namei.c Sun Sep 12 11:00:18 2004
@@ -816,7 +816,7 @@
break;
if (lookup_flags & LOOKUP_DIRECTORY) {
err = -ENOTDIR;
- if (!inode->i_op || !inode->i_op->lookup)
+ if (!S_ISDIR(inode->i_mode))
break;
}
goto return_base;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/