summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Olsa <Jiri Olsa jolsa@redhat.com>2011-05-30 20:24:47 +0200
committerJiri Olsa <Jiri Olsa jolsa@redhat.com>2011-05-30 20:24:47 +0200
commit481bb4e02903a0023ed0c15bb87711479642cc8c (patch)
tree66a7caf31a0b7747ced0f46879fd086c703311c1
parent16a729e69e28c58cf7994a3f9135fb9fc5e48f5e (diff)
downloadlatrace-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
-rw-r--r--ChangeLog4
-rw-r--r--src/run.c9
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 <olsajiri@gmail.com>
+ * fixed bug in tracer waiting code
+ (do not exit the loop prematurely)
+
2011-05-25 Jiri Olsa <olsajiri@gmail.com>
* 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;