summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--winsup/cygwin/fhandler_fifo.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc
index 409144fda..0a6dc0591 100644
--- a/winsup/cygwin/fhandler_fifo.cc
+++ b/winsup/cygwin/fhandler_fifo.cc
@@ -480,7 +480,14 @@ fhandler_fifo::open (int flags, mode_t)
res = error_errno_set;
goto out;
}
- fh->set_handle (ph);
+ if (!DuplicateHandle (GetCurrentProcess (), ph, GetCurrentProcess (),
+ &fh->get_handle (), 0, true, DUPLICATE_SAME_ACCESS))
+ {
+ res = error_set_errno;
+ fh->close ();
+ delete fh;
+ goto out;
+ }
fh->set_flags (flags);
if (!(connect_evt = create_event ()))
{