aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/dtable.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/dtable.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/dtable.cc')
-rw-r--r--winsup/cygwin/dtable.cc23
1 files changed, 5 insertions, 18 deletions
diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc
index a47a77d..ba0045f 100644
--- a/winsup/cygwin/dtable.cc
+++ b/winsup/cygwin/dtable.cc
@@ -237,26 +237,13 @@ dtable::find_unused_handle (int start)
return -1;
}
-bool
+void
dtable::release (int fd)
{
- bool deleted;
- if (not_open (fd))
- deleted = false;
- else
- {
- if (fds[fd]->need_fixup_before ())
- dec_need_fixup_before ();
- if (fds[fd]->refcnt (-1) > 0)
- deleted = false;
- else
- {
- deleted = true;
- delete fds[fd];
- }
- fds[fd] = NULL;
- }
- return deleted;
+ if (fds[fd]->need_fixup_before ())
+ dec_need_fixup_before ();
+ fds[fd]->refcnt (-1);
+ fds[fd] = NULL;
}
extern "C" int