binfmt_misc: replace get_unused_fd() with get_unused_fd_flags(0)
authorYann Droneaud <ydroneaud@opteya.com>
Wed, 10 Dec 2014 23:45:42 +0000 (15:45 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 11 Dec 2014 01:41:10 +0000 (17:41 -0800)
This patch replaces calls to get_unused_fd() with equivalent call to
get_unused_fd_flags(0) to preserve current behavor for existing code.

In a further patch, get_unused_fd() will be removed so that new code start
using get_unused_fd_flags(), with the hope O_CLOEXEC could be used, either
by default or choosen by userspace.

Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/binfmt_misc.c

index fd8beb9..1cc5377 100644 (file)
@@ -153,7 +153,7 @@ static int load_misc_binary(struct linux_binprm *bprm)
                /* if the binary should be opened on behalf of the
                 * interpreter than keep it open and assign descriptor
                 * to it */
-               fd_binary = get_unused_fd();
+               fd_binary = get_unused_fd_flags(0);
                if (fd_binary < 0) {
                        retval = fd_binary;
                        goto _ret;