Cygwin: FIFO: update clone and dup

Deal with all clients.
This commit is contained in:
Ken Brown
2019-03-22 19:30:39 +00:00
committed by Corinna Vinschen
parent c6e221c036
commit 035bf7dc84
2 changed files with 30 additions and 3 deletions

View File

@ -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;
}