From d9492ab8d2d7aa90f6ac0fe2928e001c5a4f01fa Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Mon, 19 Mar 2012 16:51:30 +0000 Subject: [PATCH] * pinfo.cc (pinfo::wait): Handle case where prefork was not called prior to calling wait(). This is the case when we are reabsorbing processes after being execed. --- winsup/cygwin/ChangeLog | 6 ++++++ winsup/cygwin/pinfo.cc | 13 ++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index ebcf00afd..3c25957d1 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2012-03-19 Christopher Faylor + + * pinfo.cc (pinfo::wait): Handle case where prefork was not called + prior to calling wait(). This is the case when we are reabsorbing + processes after being execed. + 2012-03-16 Christopher Faylor * fork.cc (lock_signals): Move to sigproc.h. diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index c5e646455..bc0de4735 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -987,12 +987,15 @@ proc_waiter (void *arg) bool pinfo::wait () { - rd_proc_pipe = pending_rd_proc_pipe; - pending_rd_proc_pipe = NULL; + if (pending_rd_proc_pipe) + { + rd_proc_pipe = pending_rd_proc_pipe; + pending_rd_proc_pipe = NULL; - wr_proc_pipe () = pending_wr_proc_pipe; - ForceCloseHandle1 (pending_wr_proc_pipe, wr_proc_pipe); - pending_wr_proc_pipe = NULL; + wr_proc_pipe () = pending_wr_proc_pipe; + ForceCloseHandle1 (pending_wr_proc_pipe, wr_proc_pipe); + pending_wr_proc_pipe = NULL; + } preserve (); /* Preserve the shared memory associated with the pinfo */ -- 2.43.5