result[0] = 0;
- if (WIFEXITED(status))
+ if (WIFEXITED(status)) {
APPEND ("WIFEXITED %d ", WEXITSTATUS(status));
+ }
if (WIFSIGNALED(status)) {
APPEND ("WIFSIGNALED %d ", WTERMSIG(status));
if (res != 0) {
ERROR(errno, "PT_LWPINFO failed: signal lost !!!!\n");
signal_queue_sz--;
- } else
+ } else {
DEBUG(1, "waitstopped PTRACE_CONT, queuing signal %d"
" si_signo %d si_pid %d\n",
signal_received, newsiginfo->si_signo, newsiginfo->si_pid);
+ }
res = ptrace (PT_CONTINUE, pid, (caddr_t)1, 0);
} else {
DEBUG(1, "waitstopped PT_CONTINUE with signal %d\n", signal_received);
if (res != 0) {
if (output_error || debuglevel > 0) {
ERROR(errno, "%s PT_ATTACH pid %d %ld\n", msg, pid, res);
- if (initial_attach)
+ if (initial_attach) {
output_error = False;
+ }
}
return False;
}
before resetting the registers. */
if (pid_of_save_regs_continued) {
pid_of_save_regs_continued = False;
- if (!stop(pid_of_save_regs, "sigstop before reset regs"))
+ if (!stop(pid_of_save_regs, "sigstop before reset regs")) {
DEBUG(0, "Could not sigstop before reset");
+ }
}
DEBUG(1, "setregs restore registers pid %d\n", pid_of_save_regs);
signal_queue[i].si_signo);
res = ptrace (PT_CONTINUE, pid_of_save_regs, (caddr_t)1,
signal_queue[i].si_signo);
- if (res != 0)
+ if (res != 0) {
ERROR(errno, "PT_CONTINUE with signal %d\n",
signal_queue[i].si_signo);
- if (!stop(pid_of_save_regs, "sigstop after transmit sig"))
+ }
+ if (!stop(pid_of_save_regs, "sigstop after transmit sig")) {
DEBUG(0, "Could not sigstop after transmit sig");
+ }
}
free (signal_queue);
signal_queue = NULL;
} else {
DEBUG(1, "PTRACE_SETREGS restore registers: no pid\n");
}
- if (signal_queue)
+ if (signal_queue) {
ERROR (0, "One or more signals queued were not delivered. "
"First signal: %d\n", signal_queue[0].si_signo);
+ }
detach_from_all_threads(pid);
}
pid_of_save_regs_continued = False;
restore_and_detach(pid);
return True;
- } else {
- /* Whatever kind of problem happened. We shutdown. */
- shutting_down = True;
- return False;
}
+ /* Whatever kind of problem happened. We shutdown. */
+ shutting_down = True;
+ return False;
}
void invoker_cleanup_restore_and_detach(void *v_pid)
{
DEBUG(1, "invoker_cleanup_restore_and_detach dying: %d\n", dying);
- if (!dying)
+ if (!dying) {
restore_and_detach(*(int*)v_pid);
+ }
}
void invoker_restrictions_msg(void)