From: Dmitry V. Levin Date: Sun, 6 Aug 2017 15:10:56 +0000 (+0000) Subject: Simplify handling of unexpected tracees X-Git-Tag: v4.19~173 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=330f4633d5103938982602b6f21f761570e3482c;p=strace 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. --- 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; } }