diff --git a/signal.c b/signal.c index 25db0a0e..ed413adf 100644 --- a/signal.c +++ b/signal.c @@ -1120,23 +1120,20 @@ struct tcb *tcp; else if (umove(tcp, addr, &sa) < 0) tprintf("{...}"); else { - switch ((long) sa.SA_HANDLER) { - case (long) SIG_ERR: - tprintf("{SIG_ERR}"); - break; - case (long) SIG_DFL: - tprintf("{SIG_DFL}"); - break; - case (long) SIG_IGN: + if (sa.SA_HANDLER == SIG_ERR) + tprintf("{SIG_ERR, "); + else if (sa.SA_HANDLER == SIG_DFL) + tprintf("{SIG_DFL, "); + else if (sa.SA_HANDLER == SIG_DFL) { #ifndef USE_PROCFS if (tcp->u_arg[0] == SIGTRAP) { tcp->flags |= TCB_SIGTRAPPED; kill(tcp->pid, SIGSTOP); } #endif /* !USE_PROCFS */ - tprintf("{SIG_IGN}"); - break; - default: + tprintf("{SIG_IGN, "); + } + else { #ifndef USE_PROCFS if (tcp->u_arg[0] == SIGTRAP) { tcp->flags |= TCB_SIGTRAPPED; @@ -1865,7 +1862,7 @@ struct new_sigaction }; - int +int sys_rt_sigaction(tcp) struct tcb *tcp; { @@ -1886,38 +1883,33 @@ sys_rt_sigaction(tcp) else if (umove(tcp, addr, &sa) < 0) tprintf("{...}"); else { - switch ((long) sa.__sigaction_handler.__sa_handler) { - case (long) SIG_ERR: - tprintf("{SIG_ERR}"); - break; - case (long) SIG_DFL: - tprintf("{SIG_DFL}"); - break; - case (long) SIG_IGN: - tprintf("{SIG_IGN}"); - break; - default: - tprintf("{%#lx, ", - (long) sa.__sigaction_handler.__sa_handler); - sigemptyset(&sigset); + if (sa.__sigaction_handler.__sa_handler == SIG_ERR) + tprintf("{SIG_ERR, "); + else if (sa.__sigaction_handler.__sa_handler == SIG_DFL) + tprintf("{SIG_DFL, "); + else if (sa.__sigaction_handler.__sa_handler == SIG_DFL) + tprintf("{SIG_IGN, "); + else + tprintf("{%#lx, ", + (long) sa.__sigaction_handler.__sa_handler); + sigemptyset(&sigset); #ifdef LINUXSPARC - if (tcp->u_arg[4] <= sizeof(sigset)) - memcpy(&sigset, &sa.sa_mask, tcp->u_arg[4]); + if (tcp->u_arg[4] <= sizeof(sigset)) + memcpy(&sigset, &sa.sa_mask, tcp->u_arg[4]); #else - if (tcp->u_arg[3] <= sizeof(sigset)) - memcpy(&sigset, &sa.sa_mask, tcp->u_arg[3]); + if (tcp->u_arg[3] <= sizeof(sigset)) + memcpy(&sigset, &sa.sa_mask, tcp->u_arg[3]); #endif - else - memcpy(&sigset, &sa.sa_mask, sizeof(sigset)); - printsigmask(&sigset, 1); - tprintf(", "); - printflags(sigact_flags, sa.sa_flags, "SA_???"); + else + memcpy(&sigset, &sa.sa_mask, sizeof(sigset)); + printsigmask(&sigset, 1); + tprintf(", "); + printflags(sigact_flags, sa.sa_flags, "SA_???"); #ifdef SA_RESTORER - if (sa.sa_flags & SA_RESTORER) - tprintf(", %p", sa.sa_restorer); + if (sa.sa_flags & SA_RESTORER) + tprintf(", %p", sa.sa_restorer); #endif - tprintf("}"); - } + tprintf("}"); } if (entering(tcp)) tprintf(", ");