Commit dc5178fa authored by David Howells's avatar David Howells Committed by Linus Torvalds

[PATCH] FD_CLOEXEC fcntl cleanup

This fixes a minor problem with fcntl.

get_close_on_exec() uses FD_ISSET() to determine the fd state, but this
is not guaranteed to be either 0 of FD_CLOEXEC.  Make that explicit.

Also, the argument of set_close_on_exec() is being AND'ed with the
literal constant 1.  Make it use an explicit FD_CLOEXEC test.
parent 437117bf
......@@ -293,11 +293,11 @@ static long do_fcntl(unsigned int fd, unsigned int cmd,
err = dupfd(filp, arg);
break;
case F_GETFD:
err = get_close_on_exec(fd);
err = get_close_on_exec(fd) ? FD_CLOEXEC : 0;
break;
case F_SETFD:
err = 0;
set_close_on_exec(fd, arg&1);
set_close_on_exec(fd, arg & FD_CLOEXEC);
break;
case F_GETFL:
err = filp->f_flags;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment