* config.in, configure: Regenerated.

* configure.ac: Check for waitpid.
	* ser-pipe.c (pipe_close): Wait for the program to exit.
This commit is contained in:
Daniel Jacobowitz 2010-09-02 17:12:38 +00:00
parent 58b61394cf
commit 0a4f61e3e4
5 changed files with 19 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2010-09-02 Daniel Jacobowitz <dan@codesourcery.com>
* config.in, configure: Regenerated.
* configure.ac: Check for waitpid.
* ser-pipe.c (pipe_close): Wait for the program to exit.
2010-09-02 Jan Kratochvil <jan.kratochvil@redhat.com>
* cli-logging.c: Include gdb_assert.h.

View File

@ -676,6 +676,9 @@
/* Define to 1 if you have the <vfork.h> header file. */
#undef HAVE_VFORK_H
/* Define to 1 if you have the `waitpid' function. */
#undef HAVE_WAITPID
/* Define to 1 if you have the <wait.h> header file. */
#undef HAVE_WAIT_H

2
gdb/configure vendored
View File

@ -12550,7 +12550,7 @@ for ac_func in canonicalize_file_name realpath getrusage getuid \
getgid pipe poll pread64 resize_term sbrk setpgid setpgrp setsid \
sigaction sigprocmask sigsetmask socketpair syscall \
ttrace wborder wresize setlocale iconvlist libiconvlist btowc \
setrlimit getrlimit posix_madvise
setrlimit getrlimit posix_madvise waitpid
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"

View File

@ -962,7 +962,7 @@ AC_CHECK_FUNCS([canonicalize_file_name realpath getrusage getuid \
getgid pipe poll pread64 resize_term sbrk setpgid setpgrp setsid \
sigaction sigprocmask sigsetmask socketpair syscall \
ttrace wborder wresize setlocale iconvlist libiconvlist btowc \
setrlimit getrlimit posix_madvise])
setrlimit getrlimit posix_madvise waitpid])
AM_LANGINFO_CODESET
# Check the return and argument types of ptrace. No canned test for

View File

@ -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;