diff --git a/[refs] b/[refs] index ede34982af39..f965e640ed41 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 58ec42b061bf5dad8fa0370a19966cfd96eaf80c +refs/heads/master: 3c333937ee3be114b181c4861188cfe8f6a59697 diff --git a/trunk/fs/fcntl.c b/trunk/fs/fcntl.c index 9679fcbdeaa0..ce12a6885115 100644 --- a/trunk/fs/fcntl.c +++ b/trunk/fs/fcntl.c @@ -139,8 +139,13 @@ asmlinkage long sys_dup3(unsigned int oldfd, unsigned int newfd, int flags) if (!(file = fcheck(oldfd))) goto out_unlock; err = newfd; - if (newfd == oldfd) + if (unlikely(newfd == oldfd)) { + if (flags & O_CLOEXEC) { + fdt = files_fdtable(files); + FD_SET(newfd, fdt->close_on_exec); + } goto out_unlock; + } err = -EBADF; if (newfd >= current->signal->rlim[RLIMIT_NOFILE].rlim_cur) goto out_unlock;