diff options
author | Jiri Olsa <Jiri Olsa jolsa@redhat.com> | 2011-05-30 20:24:47 +0200 |
---|---|---|
committer | Jiri Olsa <Jiri Olsa jolsa@redhat.com> | 2011-05-30 20:24:47 +0200 |
commit | 481bb4e02903a0023ed0c15bb87711479642cc8c (patch) | |
tree | 66a7caf31a0b7747ced0f46879fd086c703311c1 /src | |
parent | 16a729e69e28c58cf7994a3f9135fb9fc5e48f5e (diff) | |
download | latrace-481bb4e02903a0023ed0c15bb87711479642cc8c.tar.gz latrace-481bb4e02903a0023ed0c15bb87711479642cc8c.tar.xz latrace-481bb4e02903a0023ed0c15bb87711479642cc8c.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/run.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -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; |