summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/dtable.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/dtable.cc')
-rw-r--r--winsup/cygwin/dtable.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc
index b5f9a9136..88c3adced 100644
--- a/winsup/cygwin/dtable.cc
+++ b/winsup/cygwin/dtable.cc
@@ -580,9 +580,14 @@ dtable::vfork_child_fixup ()
for (int i = 0; i < (int) cygheap->fdtab.size; i++)
if ((fh = cygheap->fdtab[i]) != NULL)
{
- fh->close ();
fh->clear_readahead ();
- cygheap->fdtab.release (i);
+ if (fh->get_close_on_exec ())
+ release (i);
+ else
+ {
+ fh->close ();
+ cygheap->fdtab.release (i);
+ }
}
fds = saveme;