Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
[pandora-kernel.git] / fs / signalfd.c
index c8609fa..9c39bc7 100644 (file)
@@ -211,7 +211,11 @@ asmlinkage long sys_signalfd4(int ufd, sigset_t __user *user_mask,
        sigset_t sigmask;
        struct signalfd_ctx *ctx;
 
-       if (flags & ~SFD_CLOEXEC)
+       /* Check the SFD_* constants for consistency.  */
+       BUILD_BUG_ON(SFD_CLOEXEC != O_CLOEXEC);
+       BUILD_BUG_ON(SFD_NONBLOCK != O_NONBLOCK);
+
+       if (flags & ~(SFD_CLOEXEC | SFD_NONBLOCK))
                return -EINVAL;
 
        if (sizemask != sizeof(sigset_t) ||
@@ -232,7 +236,7 @@ asmlinkage long sys_signalfd4(int ufd, sigset_t __user *user_mask,
                 * anon_inode_getfd() will install the fd.
                 */
                ufd = anon_inode_getfd("[signalfd]", &signalfd_fops, ctx,
-                                      flags & O_CLOEXEC);
+                                      flags & (O_CLOEXEC | O_NONBLOCK));
                if (ufd < 0)
                        kfree(ctx);
        } else {