Small code restructuring

This commit is contained in:
topjohnwu 2019-03-11 12:44:50 -04:00
parent 771e500468
commit a4a661bf34

View File

@ -391,7 +391,11 @@ void proc_monitor() {
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]) {
PTRACE_LOG("detach\n");
DETACH_AND_CONT;
@ -455,10 +459,5 @@ void proc_monitor() {
xptrace(PTRACE_CONT, pid, nullptr, WSTOPSIG(status));
PTRACE_LOG("signal [%d]\n", WSTOPSIG(status));
}
} else {
// Nothing to do with us
PTRACE_LOG("terminate\n");
DETACH_AND_CONT;
}
}
}