I've been looking into that, and my head hurts. It looks too simple, so I'm
sure I'm reading it wrong.
What does the LOOKUP_FOLLOW flag to lookup_dentry() do?
open_namei() seems to call lookup_dentry() with LOOKUP_FOLLOW set by default,
unless the flags passed to open_namei() include O_CREAT and O_EXCL...
/*
* Special case: O_CREAT|O_EXCL on a dangling symlink should
* give EEXIST for security reasons. While inconsistent, this
* 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));
So what happens if I add a new flags O_NOFOLLOW, and make open_namei clear the
LOOKUP_FOLLOW bit when O_NOFOLLOW is set?
Judging by the comment extracted above, it'll behave correctly for the
dangling symlink case, but not when the symlink points to a real file.
I suppose I should just try it.
---- ---- ----
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/