summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2006-03-20 04:05:24 +0000
committerMark Mitchell <mark@codesourcery.com>2006-03-20 04:05:24 +0000
commitfc5326d2c5719a1542002b610e75960cb8fe7656 (patch)
tree9b1cdba2142f39707feb1a55758fb91ab7e12fa5
parent9d3d0fe8cfc3f5288cae42e86cafc7b351c98f06 (diff)
downloadbinutils-gdb-fc5326d2c5719a1542002b610e75960cb8fe7656.tar.gz
* gdb/ser-mingw.c (free_pipe_state): Close pipe before calling
pex_free.
-rw-r--r--gdb/ser-mingw.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gdb/ser-mingw.c b/gdb/ser-mingw.c
index 5d0c0733b57..b5cd16eb26c 100644
--- a/gdb/ser-mingw.c
+++ b/gdb/ser-mingw.c
@@ -616,10 +616,13 @@ free_pipe_state (struct pipe_state *ps)
if (ps->wait.stop_select != INVALID_HANDLE_VALUE)
SetEvent (ps->wait.stop_select);
- if (ps->pex)
- pex_free (ps->pex);
+ /* Close the pipe to the child. We must close the pipe before
+ calling pex_free because pex_free will wait for the child to exit
+ and the child will not exit until the pipe is closed. */
if (ps->input)
fclose (ps->input);
+ if (ps->pex)
+ pex_free (ps->pex);
/* pex_free closes ps->output. */
xfree (ps);