summaryrefslogtreecommitdiff
path: root/gdb/ser-pipe.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <dan@debian.org>2010-09-02 17:12:32 +0000
committerDaniel Jacobowitz <dan@debian.org>2010-09-02 17:12:32 +0000
commit5c05b641346f70bd4884766ad38b67735618fbe2 (patch)
tree8fb22cdf15aa2d8cfd30d13a0ede3f5226ed5d22 /gdb/ser-pipe.c
parent812ad48c254399696c0aa73e92753e5b40929c1b (diff)
downloadgdb-5c05b641346f70bd4884766ad38b67735618fbe2.tar.gz
* 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 d26dc4fa497..5b439f7c368 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;