X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;ds=sidebyside;f=gdb%2Fser-pipe.c;h=5b439f7c3687d77f83be9d5c8d7b2ec0c5558c5b;hb=0a4f61e3e4c32971615274aed323a1be06117551;hp=d26dc4fa497fc053d3f37691aa3ea171c3312d93;hpb=58b61394cfd1f96444c1debd9ba9e0ea69d439f2;p=binutils-gdb.git 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 #include #include "gdb_string.h" +#include "gdb_wait.h" #include @@ -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;