It would appear so - the only operations we're affecting are those with
O_NOFOLLOW set, and those currently total zero, as we've only just defined it.
Second version (i386 only for now)...
--- linux/fs/namei.c.nofollow Wed Oct 21 00:30:39 1998
+++ linux/fs/namei.c Wed Oct 21 01:15:13 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;
@@ -575,6 +576,12 @@
error = -EEXIST;
if (dentry->d_inode && (flag & O_EXCL))
goto exit;
+ if (dentry->d_inode && dentry->d_inode->i_op->follow_link &&
+ (flag & O_NOFOLLOW))
+ {
+ error = -EMLINK;
+ goto exit;
+ }
dir = lock_parent(dentry);
error = PTR_ERR(dir);
--- 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/