On Fri, Jul 12, 2013 at 12:39 PM, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote: > > I mean something like this: > > Safer ABI for O_TMPFILE > > [suggested by Rasmus Villemoes] make O_DIRECTORY | O_RDWR part of O_TMPFILE; > that will fail on old kernels in a lot more cases than what I came up with. So see earlier about why I'm not convinced about O_RDWR. But even if we really want that (and it might be better to start off too narrow than accept anything else) your patch tests those bits the wrong way (any O_RDWR test should be done using the O_ACCMODE mask, not using the O_RDWR value itself as a mask) Also, to make sure that the "no preexisting file" case fails, I still think you should also verify that O_CREAT is not set. Otherwise Rasmus' case open("/tmp/test/link_to_nowhere", O_DIRECTORY | O_RDWR, 0666) -> -1; No such file or directory can work, and the case that rasmus didn't have at all (non-existent pathname) also just silently succeeds by creating a file instead of the expected directory.. So you could have something like #define O_TMPFILE (__O_TMPFILE | O_DIRECTORY | O_RDWR) #define O_TMPFILE_MASK (__O_TMPFILE | O_DIRECTORY | O_CREAT | O_ACCMODE) and then use if ((flags & O_TMPFILE_MASK) != O_TMPFILE) return -ENOTSUPP; or whatever. Hmm? Linus -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html