Skip to main content
summaryrefslogtreecommitdiffstats
path: root/agent
diff options
context:
space:
mode:
authorEugene Tarassov2013-11-13 13:19:36 -0500
committerEugene Tarassov2013-11-13 13:19:36 -0500
commit4fed88c82b781989a556f902024bd502fcac4f22 (patch)
treef4e6756f7325923e1b5c56efc080beda7e8570a7 /agent
parent923cdcba1e36852c0d4e94e89635ef6231a38e84 (diff)
downloadorg.eclipse.tcf.agent-4fed88c82b781989a556f902024bd502fcac4f22.tar.gz
org.eclipse.tcf.agent-4fed88c82b781989a556f902024bd502fcac4f22.tar.xz
org.eclipse.tcf.agent-4fed88c82b781989a556f902024bd502fcac4f22.zip
TCF Agent: fixed: Assertion `ctx->ref_count > 0' can fail if a process exits before agent finishes attaching the process
Diffstat (limited to 'agent')
-rw-r--r--agent/system/Darwin/tcf/context-darwin.c2
-rw-r--r--agent/system/FreeBSD/tcf/context-freebsd.c2
-rw-r--r--agent/system/GNU/Linux/tcf/context-linux.c2
3 files changed, 3 insertions, 3 deletions
diff --git a/agent/system/Darwin/tcf/context-darwin.c b/agent/system/Darwin/tcf/context-darwin.c
index 55fcf739..2b6cb508 100644
--- a/agent/system/Darwin/tcf/context-darwin.c
+++ b/agent/system/Darwin/tcf/context-darwin.c
@@ -505,6 +505,7 @@ static void event_pid_exited(pid_t pid, int status, int signal) {
}
else {
assert(ctx->ref_count == 0);
+ ctx->ref_count = 1;
if (EXT(ctx)->attach_callback != NULL) {
if (status == 0) status = EINVAL;
EXT(ctx)->attach_callback(status, ctx, EXT(ctx)->attach_data);
@@ -512,7 +513,6 @@ static void event_pid_exited(pid_t pid, int status, int signal) {
assert(list_is_empty(&ctx->children));
assert(ctx->parent == NULL);
ctx->exited = 1;
- ctx->ref_count = 1;
context_unlock(ctx);
}
}
diff --git a/agent/system/FreeBSD/tcf/context-freebsd.c b/agent/system/FreeBSD/tcf/context-freebsd.c
index 69deef2e..ad20560d 100644
--- a/agent/system/FreeBSD/tcf/context-freebsd.c
+++ b/agent/system/FreeBSD/tcf/context-freebsd.c
@@ -499,6 +499,7 @@ static void event_pid_exited(pid_t pid, int status, int signal) {
}
else {
assert(ctx->ref_count == 0);
+ ctx->ref_count = 1;
if (EXT(ctx)->attach_callback != NULL) {
if (status == 0) status = EINVAL;
EXT(ctx)->attach_callback(status, ctx, EXT(ctx)->attach_data);
@@ -506,7 +507,6 @@ static void event_pid_exited(pid_t pid, int status, int signal) {
assert(list_is_empty(&ctx->children));
assert(ctx->parent == NULL);
ctx->exited = 1;
- ctx->ref_count = 1;
context_unlock(ctx);
}
}
diff --git a/agent/system/GNU/Linux/tcf/context-linux.c b/agent/system/GNU/Linux/tcf/context-linux.c
index 74e93694..fb168aef 100644
--- a/agent/system/GNU/Linux/tcf/context-linux.c
+++ b/agent/system/GNU/Linux/tcf/context-linux.c
@@ -1072,6 +1072,7 @@ static void event_pid_exited(pid_t pid, int status, int signal) {
}
else {
assert(ctx->ref_count == 0);
+ ctx->ref_count = 1;
if (EXT(ctx)->attach_callback != NULL) {
if (status == 0) status = EINVAL;
EXT(ctx)->attach_callback(status, ctx, EXT(ctx)->attach_data);
@@ -1079,7 +1080,6 @@ static void event_pid_exited(pid_t pid, int status, int signal) {
assert(list_is_empty(&ctx->children));
assert(ctx->parent == NULL);
ctx->exited = 1;
- ctx->ref_count = 1;
context_unlock(ctx);
}
}

Back to the top