hehe - same here.
If you've done the same as I have, then it returns success upon opening s
symlink, and then EINVAL when you try to write it.
When O_NOFOLLOW is set, can we simply add a check for whether the resulting
inode is a link, and then return failure if so?
--- linux/fs/namei.c.nofollow Wed Oct 21 00:30:39 1998
+++ linux/fs/namei.c Wed Oct 21 00:48:35 1998
@@ -564,7 +564,8 @@
* is the same scheme used by, for example, Solaris 2.5.1. --KAB
*/
dentry = lookup_dentry(pathname, NULL,
- (flag & (O_CREAT|O_EXCL)) != (O_CREAT|O_EXCL));
+ (flag & (O_CREAT|O_EXCL)) != (O_CREAT|O_EXCL)
+ && !(flag & O_NOFOLLOW));
if (IS_ERR(dentry))
return dentry;
--- linux/fs/open.c.nofollow Wed Oct 21 00:38:35 1998
+++ linux/fs/open.c Wed Oct 21 00:38:51 1998
@@ -665,7 +665,7 @@
if (error)
goto cleanup_all;
}
- f->f_flags &= ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC);
+ f->f_flags &= ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC | O_NOFOLLOW);
fd_install(fd, f);
return 0;
--- linux/include/asm-i386/fcntl.h.nofollow Wed Oct 21 00:28:52 1998
+++ linux/include/asm-i386/fcntl.h Wed Oct 21 00:30:25 1998
@@ -18,6 +18,7 @@
#define FASYNC 020000 /* fcntl, for BSD compatibility */
#define O_DIRECT 040000 /* direct disk access hint - currently ignored */
#define O_LARGEFILE 0100000
+#define O_NOFOLLOW 0200000 /* not fcntl */
#define F_DUPFD 0 /* dup */
#define F_GETFD 1 /* get f_flags */
---- ---- ----
David Woodhouse David.Woodhouse@mvhi.com Office: (+44) 1223 810302
Project Leader, Process Information Systems Mobile: (+44) 976 658355
Axiom (Cambridge) Ltd., Swaffham Bulbeck, Cambridge, CB5 0NA, UK.
finger dwmw2@ferret.lmh.ox.ac.uk for PGP key.
-
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/