]> granicus.if.org Git - strace/commitdiff
Simplify handling of unexpected tracees
authorDmitry V. Levin <ldv@altlinux.org>
Sun, 6 Aug 2017 15:10:56 +0000 (15:10 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Sun, 6 Aug 2017 15:10:56 +0000 (15:10 +0000)
* strace.c (maybe_allocate_tcb) <WIFSTOPPED(status) && !followfork>:
Remove the dance around possible re-injection of WSTOPSIG(status)
as the only observable stop here is the initial ptrace-stop.

strace.c

index 9217efe4c486631e4b2b8aaf4d35a3b4f9a78915..af44c626531f65c229a04af0d37c3367e8306f7a 100644 (file)
--- 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;
        }
 }