Fix F_DUPFD_CLOEXEC breakage
authorAl Viro <viro@ZenIV.linux.org.uk>
Mon, 8 Oct 2012 22:21:58 +0000 (23:21 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 9 Oct 2012 06:52:31 +0000 (15:52 +0900)
Fix a braino in F_DUPFD_CLOEXEC; f_dupfd() expects flags for alloc_fd(),
get_unused_fd() etc and there clone-on-exec if O_CLOEXEC, not
FD_CLOEXEC.

Reported-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/fcntl.c

index 8f70429..71a600a 100644 (file)
@@ -258,7 +258,7 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned long arg,
                err = f_dupfd(arg, filp, 0);
                break;
        case F_DUPFD_CLOEXEC:
-               err = f_dupfd(arg, filp, FD_CLOEXEC);
+               err = f_dupfd(arg, filp, O_CLOEXEC);
                break;
        case F_GETFD:
                err = get_close_on_exec(fd) ? FD_CLOEXEC : 0;