]> err.no Git - linux-2.6/blobdiff - fs/inotify_user.c
[patch 05/14] hpfs: dont call permission()
[linux-2.6] / fs / inotify_user.c
index 851005998cd449e6fb450bbc93af0862f9f95008..fe79c25d95dc9c630649aec8485b784bbb34d49c 100644 (file)
@@ -574,7 +574,11 @@ asmlinkage long sys_inotify_init1(int flags)
        struct file *filp;
        int fd, ret;
 
-       if (flags & ~IN_CLOEXEC)
+       /* Check the IN_* constants for consistency.  */
+       BUILD_BUG_ON(IN_CLOEXEC != O_CLOEXEC);
+       BUILD_BUG_ON(IN_NONBLOCK != O_NONBLOCK);
+
+       if (flags & ~(IN_CLOEXEC | IN_NONBLOCK))
                return -EINVAL;
 
        fd = get_unused_fd_flags(flags & O_CLOEXEC);
@@ -613,7 +617,7 @@ asmlinkage long sys_inotify_init1(int flags)
        filp->f_path.dentry = dget(inotify_mnt->mnt_root);
        filp->f_mapping = filp->f_path.dentry->d_inode->i_mapping;
        filp->f_mode = FMODE_READ;
-       filp->f_flags = O_RDONLY;
+       filp->f_flags = O_RDONLY | (flags & O_NONBLOCK);
        filp->private_data = dev;
 
        INIT_LIST_HEAD(&dev->events);