From 481bb4e02903a0023ed0c15bb87711479642cc8c Mon Sep 17 00:00:00 2001 From: Jiri Olsa Date: Mon, 30 May 2011 20:24:47 +0200 Subject: tracer waiting code - do not exit the wait loop prematurely if the tracee died we break the loop leaving the tracee socket(s) full of data, caused by recent code refactoring --- ChangeLog | 4 ++++ src/run.c | 9 ++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1ddb043..bfd0ba9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2011-05-30 Jiri Olsa + * fixed bug in tracer waiting code + (do not exit the loop prematurely) + 2011-05-25 Jiri Olsa * adding SIGTERM/SIGINT handlers, refactoring lt_run to check the latrace got killed diff --git a/src/run.c b/src/run.c index 9a5fa43..7f48b53 100644 --- a/src/run.c +++ b/src/run.c @@ -155,7 +155,7 @@ static int process(struct lt_config_app *cfg, struct lt_process_args *pa) fd_set cfg_set, wrk_set; int fd_notify = pa->fd_notify; int fd_tty_master = pa->fd_tty_master; - int max_fd = 0, wait; + int max_fd = 0; #define MAX(a,b) ((a) < (b) ? (b) : (a)) FD_ZERO(&cfg_set); @@ -176,7 +176,7 @@ static int process(struct lt_config_app *cfg, struct lt_process_args *pa) max_fd = MAX(fd_notify, fd_tty_master); } - while(((wait = waitpid(pa->pid, &status, WNOHANG)) == 0) || + while((waitpid(pa->pid, &status, WNOHANG) == 0) || /* let all the thread fifo close */ (finish) || /* Get inside at least once, in case the traced program @@ -197,9 +197,8 @@ if (ret < 0) \ struct lt_thread *t; int ret; - /* we either got a signal or we lost the child, - * either way there's nothing to wait for.. */ - if (exit_flag || (wait == -1)) + /* we got a signal, there's nothing to wait for.. */ + if (exit_flag) break; getin = 0; -- cgit