diff options
Diffstat (limited to 'winsup/cygwin/pipe.cc')
-rw-r--r-- | winsup/cygwin/pipe.cc | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/winsup/cygwin/pipe.cc b/winsup/cygwin/pipe.cc index 1166b511d..03af86228 100644 --- a/winsup/cygwin/pipe.cc +++ b/winsup/cygwin/pipe.cc @@ -63,9 +63,7 @@ int fhandler_pipe::close () if (guard) CloseHandle (guard); if (writepipe_exists) -{debug_printf ("writepipe_exists closed"); CloseHandle (writepipe_exists); -} return res; } @@ -83,6 +81,16 @@ fhandler_pipe::hit_eof () return ev == NULL; } +void +fhandler_pipe::fixup_after_fork (HANDLE parent) +{ + this->fhandler_base::fixup_after_fork (parent); + if (guard) + fork_fixup (parent, guard, "guard"); + if (writepipe_exists) + fork_fixup (parent, writepipe_exists, "guard"); +} + int fhandler_pipe::dup (fhandler_base *child) { @@ -96,14 +104,20 @@ fhandler_pipe::dup (fhandler_base *child) ftp->guard = NULL; else if (!DuplicateHandle (hMainProc, guard, hMainProc, &ftp->guard, 0, 1, DUPLICATE_SAME_ACCESS)) - return -1; + { + debug_printf ("couldn't duplicate guard %p, %E", guard); + return -1; + } if (writepipe_exists == NULL) ftp->writepipe_exists = NULL; else if (!DuplicateHandle (hMainProc, writepipe_exists, hMainProc, &ftp->writepipe_exists, 0, 1, DUPLICATE_SAME_ACCESS)) - return -1; + { + debug_printf ("couldn't duplicate writepipe_exists %p, %E", writepipe_exists); + return -1; + } ftp->id = id; ftp->orig_pid = orig_pid; |