aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fcntl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/fcntl.c')
-rw-r--r--fs/fcntl.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/fcntl.c b/fs/fcntl.c
index 9679fcbdeaa0..ce12a6885115 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -139,8 +139,13 @@ asmlinkage long sys_dup3(unsigned int oldfd, unsigned int newfd, int flags)
139 if (!(file = fcheck(oldfd))) 139 if (!(file = fcheck(oldfd)))
140 goto out_unlock; 140 goto out_unlock;
141 err = newfd; 141 err = newfd;
142 if (newfd == oldfd) 142 if (unlikely(newfd == oldfd)) {
143 if (flags & O_CLOEXEC) {
144 fdt = files_fdtable(files);
145 FD_SET(newfd, fdt->close_on_exec);
146 }
143 goto out_unlock; 147 goto out_unlock;
148 }
144 err = -EBADF; 149 err = -EBADF;
145 if (newfd >= current->signal->rlim[RLIMIT_NOFILE].rlim_cur) 150 if (newfd >= current->signal->rlim[RLIMIT_NOFILE].rlim_cur)
146 goto out_unlock; 151 goto out_unlock;