aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/syscalls.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2012-01-22 07:27:57 +0000
committerChristopher Faylor <me@cgf.cx>2012-01-22 07:27:57 +0000
commit0646a508aa06cf300214187237714b14cd5d5136 (patch)
tree59a7c784b10b660cfc42ebcb495fb2850ddee3e7 /winsup/cygwin/syscalls.cc
parentad87edbe61a324a67be86eb0d2efafa4d52b4a6f (diff)
downloadnewlib-0646a508aa06cf300214187237714b14cd5d5136.zip
newlib-0646a508aa06cf300214187237714b14cd5d5136.tar.gz
newlib-0646a508aa06cf300214187237714b14cd5d5136.tar.bz2
* cygheap.h (cygheap_fdmanip::release): Simplify.
* dtable.cc (dtable::release): Make void again. Skip not_open check since it is guaranteed to be open. Don't bother deleting here since actual deletion will be handled in cygheap_fdget::~cygheap_fdget. * dtable.h (dtable::release): Make void again. * syscalls.cc (dup2): Bump fhandler use count on successful dup.
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r--winsup/cygwin/syscalls.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 42c1924..350c762 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -139,8 +139,8 @@ dup2 (int oldfd, int newfd)
cygheap_fdget cfd (oldfd);
res = (cfd >= 0) ? oldfd : -1;
}
- else
- res = cygheap->fdtab.dup3 (oldfd, newfd, 0);
+ else if ((res = cygheap->fdtab.dup3 (oldfd, newfd, 0)) == newfd)
+ cygheap->fdtab[newfd]->refcnt (1);
syscall_printf ("%R = dup2(%d, %d)", res, oldfd, newfd);
return res;