fchmodat2: add support for AT_EMPTY_PATH
[linux-2.6-block.git] / fs / open.c
index e52d78e5a33304b9e4b6e2fb92180df68b4842e7..b8883ec286f5b8c61599d27ea8fbc9507c69178d 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -678,10 +678,12 @@ static int do_fchmodat(int dfd, const char __user *filename, umode_t mode,
        int error;
        unsigned int lookup_flags;
 
-       if (unlikely(flags & ~AT_SYMLINK_NOFOLLOW))
+       if (unlikely(flags & ~(AT_SYMLINK_NOFOLLOW | AT_EMPTY_PATH)))
                return -EINVAL;
 
        lookup_flags = (flags & AT_SYMLINK_NOFOLLOW) ? 0 : LOOKUP_FOLLOW;
+       if (flags & AT_EMPTY_PATH)
+               lookup_flags |= LOOKUP_EMPTY;
 
 retry:
        error = user_path_at(dfd, filename, lookup_flags, &path);