summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/pinfo.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/pinfo.cc')
-rw-r--r--winsup/cygwin/pinfo.cc13
1 files changed, 8 insertions, 5 deletions
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 */