From 0b138a7f8f5f1f00e581b420f15476087617b5fd Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 25 Jul 2008 22:32:13 -0400 Subject: [PATCH] --- yaml --- r: 106379 b: refs/heads/master c: 3c333937ee3be114b181c4861188cfe8f6a59697 h: refs/heads/master i: 106377: a3009029b05b72290fe17680ed8a51ab7232867f 106375: 148a00db7fd35efc23fa895b731830b9da7e1ee3 v: v3 --- [refs] | 2 +- trunk/fs/fcntl.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) 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;