From: Roland McGrath Date: Wed, 20 Aug 2008 01:59:40 +0000 (+0000) Subject: 2008-08-19 Roland McGrath X-Git-Tag: v4.5.18~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5f20681a258c6a5fcc4b1918c2f987dd94752c58;p=strace 2008-08-19 Roland McGrath * signal.c (sys_sigaction, sys_rt_sigaction): Don't omit the rest of the struct after sa_handler is a known constant. Some sa_flags bits have meaning even for SIG_IGN/SIG_DFL. --- 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(", ");