From 330f4633d5103938982602b6f21f761570e3482c Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Sun, 6 Aug 2017 15:10:56 +0000 Subject: [PATCH] Simplify handling of unexpected tracees * strace.c (maybe_allocate_tcb) : Remove the dance around possible re-injection of WSTOPSIG(status) as the only observable stop here is the initial ptrace-stop. --- strace.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/strace.c b/strace.c index 9217efe4..af44c626 100644 --- a/strace.c +++ b/strace.c @@ -2093,22 +2093,13 @@ maybe_allocate_tcb(const int pid, int status) } else { /* * This can happen if a clone call misused CLONE_PTRACE itself. + * + * There used to be a dance around possible re-injection of + * WSTOPSIG(status), but it was later removed as the only + * observable stop here is the initial ptrace-stop. */ - unsigned int sig = WSTOPSIG(status); - - if (use_seize) { - unsigned int event = (unsigned int) status >> 16; - if (event == PTRACE_EVENT_STOP) - sig = 0; - } else { - if (sig == SIGSTOP) - sig = 0; - } - - ptrace(PTRACE_DETACH, pid, NULL, (unsigned long) sig); - error_msg("Detached unknown pid %d%s%s", pid, - sig ? " with signal " : "", - sig ? signame(sig) : ""); + ptrace(PTRACE_DETACH, pid, NULL, 0L); + error_msg("Detached unknown pid %d", pid); return NULL; } } -- 2.40.0