aboutsummaryrefslogtreecommitdiff
path: root/gdb/ser-pipe.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2010-09-02 17:12:38 +0000
committerDaniel Jacobowitz <drow@false.org>2010-09-02 17:12:38 +0000
commit0a4f61e3e4c32971615274aed323a1be06117551 (patch)
tree985d20fa3d63569d7a787c11e0b0ca0e55d06896 /gdb/ser-pipe.c
parent58b61394cfd1f96444c1debd9ba9e0ea69d439f2 (diff)
downloadgdb-0a4f61e3e4c32971615274aed323a1be06117551.zip
gdb-0a4f61e3e4c32971615274aed323a1be06117551.tar.gz
gdb-0a4f61e3e4c32971615274aed323a1be06117551.tar.bz2
* config.in, configure: Regenerated.
* configure.ac: Check for waitpid. * ser-pipe.c (pipe_close): Wait for the program to exit.
Diffstat (limited to 'gdb/ser-pipe.c')
-rw-r--r--gdb/ser-pipe.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/gdb/ser-pipe.c b/gdb/ser-pipe.c
index d26dc4f..5b439f7 100644
--- a/gdb/ser-pipe.c
+++ b/gdb/ser-pipe.c
@@ -31,6 +31,7 @@
#include <sys/time.h>
#include <fcntl.h>
#include "gdb_string.h"
+#include "gdb_wait.h"
#include <signal.h>
@@ -162,11 +163,14 @@ pipe_close (struct serial *scb)
if (state != NULL)
{
+ int status;
kill (state->pid, SIGTERM);
- /* Might be useful to check that the child does die,
- and while we're waiting for it to die print any remaining
- stderr output. */
-
+#ifdef HAVE_WAITPID
+ /* Assume the program will exit after SIGTERM. Might be
+ useful to print any remaining stderr output from
+ scb->error_fd while waiting. */
+ waitpid (state->pid, &status, 0);
+#endif
if (scb->error_fd != -1)
close (scb->error_fd);
scb->error_fd = -1;