From 9edadc960e8bd94cbfd812156fed35557309e2f5 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Wed, 28 Sep 2005 13:55:04 +0000 Subject: [PATCH] * pinfo.cc (_pinfo::dup_proc_pipe): Ignore error if the child process has just gone away. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/pinfo.cc | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 34fafe533..6df8c85d6 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2005-09-28 Christopher Faylor + + * pinfo.cc (_pinfo::dup_proc_pipe): Ignore error if the child process + has just gone away. + 2005-09-27 Christopher Faylor * init.cc (prime_threads): Make this static, as it should be. diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index 2cceb951e..2dd727ba1 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -1040,13 +1040,14 @@ _pinfo::dup_proc_pipe (HANDLE hProcess) flags |= DUPLICATE_CLOSE_SOURCE; bool res = DuplicateHandle (hMainProc, wr_proc_pipe, hProcess, &wr_proc_pipe, 0, FALSE, flags); - if (!res) + if (!res && WaitForSingleObject (hProcess, 0) != WAIT_OBJECT_0) sigproc_printf ("DuplicateHandle failed, pid %d, hProcess %p, %E", pid, hProcess); else { wr_proc_pipe_owner = dwProcessId; sigproc_printf ("closed wr_proc_pipe %p for pid %d(%u)", wr_proc_pipe, pid, dwProcessId); + res = true; } return res; }