Commit a4a661bf authored by topjohnwu's avatar topjohnwu

Small code restructuring

parent 771e5004
...@@ -391,7 +391,11 @@ void proc_monitor() { ...@@ -391,7 +391,11 @@ void proc_monitor() {
ptrace(PTRACE_DETACH, pid, 0, 0); ptrace(PTRACE_DETACH, pid, 0, 0);
} }
}); });
if (WIFSTOPPED(status)) { if (!WIFSTOPPED(status)) {
// Nothing to do with us
PTRACE_LOG("terminate\n");
DETACH_AND_CONT;
}
if (detaches[pid]) { if (detaches[pid]) {
PTRACE_LOG("detach\n"); PTRACE_LOG("detach\n");
DETACH_AND_CONT; DETACH_AND_CONT;
...@@ -455,10 +459,5 @@ void proc_monitor() { ...@@ -455,10 +459,5 @@ void proc_monitor() {
xptrace(PTRACE_CONT, pid, nullptr, WSTOPSIG(status)); xptrace(PTRACE_CONT, pid, nullptr, WSTOPSIG(status));
PTRACE_LOG("signal [%d]\n", WSTOPSIG(status)); PTRACE_LOG("signal [%d]\n", WSTOPSIG(status));
} }
} else {
// Nothing to do with us
PTRACE_LOG("terminate\n");
DETACH_AND_CONT;
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment