aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/fhandler_fifo.cc
diff options
context:
space:
mode:
authorKen Brown <kbrown@cornell.edu>2019-03-22 19:30:39 +0000
committerCorinna Vinschen <corinna@vinschen.de>2019-03-27 14:01:45 +0100
commit035bf7dc84d98f6f643ba2dd00b08c34dc8eb984 (patch)
tree2ae79b86fbe5bf04cc005954603a15db4e5d13e9 /winsup/cygwin/fhandler_fifo.cc
parentc6e221c03668909f6c3fb399d8888629353b0191 (diff)
downloadnewlib-035bf7dc84d98f6f643ba2dd00b08c34dc8eb984.zip
newlib-035bf7dc84d98f6f643ba2dd00b08c34dc8eb984.tar.gz
newlib-035bf7dc84d98f6f643ba2dd00b08c34dc8eb984.tar.bz2
Cygwin: FIFO: update clone and dup
Deal with all clients.
Diffstat (limited to 'winsup/cygwin/fhandler_fifo.cc')
-rw-r--r--winsup/cygwin/fhandler_fifo.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc
index 1dcb3b3..c295c23 100644
--- a/winsup/cygwin/fhandler_fifo.cc
+++ b/winsup/cygwin/fhandler_fifo.cc
@@ -816,6 +816,31 @@ fhandler_fifo::dup (fhandler_base *child, int flags)
__seterrno ();
return -1;
}
+ for (int i = 0; i < nclients; i++)
+ {
+ if (!DuplicateHandle (GetCurrentProcess (), client[i].fh->get_handle (),
+ GetCurrentProcess (),
+ &fhf->client[i].fh->get_handle (),
+ 0, true, DUPLICATE_SAME_ACCESS)
+ || !DuplicateHandle (GetCurrentProcess (), client[i].connect_evt,
+ GetCurrentProcess (),
+ &fhf->client[i].connect_evt,
+ 0, true, DUPLICATE_SAME_ACCESS)
+ || !DuplicateHandle (GetCurrentProcess (), client[i].dummy_evt,
+ GetCurrentProcess (),
+ &fhf->client[i].dummy_evt,
+ 0, true, DUPLICATE_SAME_ACCESS))
+ {
+ CloseHandle (fhf->read_ready);
+ CloseHandle (fhf->write_ready);
+ fhf->close ();
+ __seterrno ();
+ return -1;
+ }
+ }
+ fhf->listen_client_thr = NULL;
+ fhf->lct_termination_evt = NULL;
+ fhf->fifo_client_unlock ();
return 0;
}