signal.c: if to switch
* signal.c (ruby_signal): turn multiple `if` statements into a `switch`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
058b5bce60
commit
b60fbca806
14
signal.c
14
signal.c
@ -532,18 +532,22 @@ ruby_signal(int signum, sighandler_t handler)
|
|||||||
sigact.sa_flags = 0;
|
sigact.sa_flags = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
switch (signum) {
|
||||||
#ifdef SA_NOCLDWAIT
|
#ifdef SA_NOCLDWAIT
|
||||||
if (signum == SIGCHLD && handler == SIG_IGN)
|
case SIGCHLD:
|
||||||
sigact.sa_flags |= SA_NOCLDWAIT;
|
if (handler == SIG_IGN)
|
||||||
|
sigact.sa_flags |= SA_NOCLDWAIT;
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(SA_ONSTACK) && defined(USE_SIGALTSTACK)
|
#if defined(SA_ONSTACK) && defined(USE_SIGALTSTACK)
|
||||||
if (signum == SIGSEGV
|
case SIGSEGV:
|
||||||
#ifdef SIGBUS
|
#ifdef SIGBUS
|
||||||
|| signum == SIGBUS
|
case SIGBUS:
|
||||||
#endif
|
#endif
|
||||||
)
|
|
||||||
sigact.sa_flags |= SA_ONSTACK;
|
sigact.sa_flags |= SA_ONSTACK;
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
(void)VALGRIND_MAKE_MEM_DEFINED(&old, sizeof(old));
|
(void)VALGRIND_MAKE_MEM_DEFINED(&old, sizeof(old));
|
||||||
if (sigaction(signum, &sigact, &old) < 0) {
|
if (sigaction(signum, &sigact, &old) < 0) {
|
||||||
if (errno != 0 && errno != EINVAL) {
|
if (errno != 0 && errno != EINVAL) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user