aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/syscalls.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2012-06-04 01:26:05 +0000
committerChristopher Faylor <me@cgf.cx>2012-06-04 01:26:05 +0000
commitb9c61a8d7b5b9bc43b3605c93fdee85c6dd04f13 (patch)
treee0bdbe1960fa0b274f8d0cc3ad582121af32af86 /winsup/cygwin/syscalls.cc
parent3143cb7c00fc1b6f4d75a83ac28f3bfbc5d2e658 (diff)
downloadnewlib-b9c61a8d7b5b9bc43b3605c93fdee85c6dd04f13.zip
newlib-b9c61a8d7b5b9bc43b3605c93fdee85c6dd04f13.tar.gz
newlib-b9c61a8d7b5b9bc43b3605c93fdee85c6dd04f13.tar.bz2
* dtable.cc (dtable::dup3): Only return with lock set when O_EXCL flag is
passed in. * syscalls.cc (dup_finish): Pass O_EXCL in flags to dtable::dup3.
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r--winsup/cygwin/syscalls.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 3c0a026..2077a0a 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -130,7 +130,7 @@ inline int
dup_finish (int oldfd, int newfd, int flags)
{
int res;
- if ((res = cygheap->fdtab.dup3 (oldfd, newfd, flags)) == newfd)
+ if ((res = cygheap->fdtab.dup3 (oldfd, newfd, flags | O_EXCL)) == newfd)
{
cygheap_fdget (newfd)->inc_refcnt ();
cygheap->fdtab.unlock (); /* dup3 exits with lock set on success */