* signal.c (sig_trap): avoid pthread_sigmask(xx, &mask, &mask) usage

because FreeBSD don't permit it. If it's used, it behave as
  pthread_sigmask(xx, NULL, &mask).

* signal.c (init_sigchld): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kosaki 2011-02-19 18:14:30 +00:00
parent 4250c745ca
commit df52785d30
2 changed files with 20 additions and 6 deletions

View File

@ -1,3 +1,11 @@
Sun Feb 20 02:14:09 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
* signal.c (sig_trap): avoid pthread_sigmask(xx, &mask, &mask) usage
because FreeBSD don't permit it. If it's used, it behave as
pthread_sigmask(xx, NULL, &mask).
* signal.c (init_sigchld): ditto.
Sun Feb 20 00:46:51 2011 Tanaka Akira <akr@fsij.org>
* ext/openssl/ossl_bn.c: parenthesize macro arguments.

View File

@ -964,11 +964,15 @@ sig_trap(int argc, VALUE *argv)
rb_raise(rb_eSecurityError, "Insecure: tainted signal trap");
}
#if USE_TRAP_MASK
/* disable interrupt */
sigfillset(&arg.mask);
pthread_sigmask(SIG_BLOCK, &arg.mask, &arg.mask);
{
sigset_t fullmask;
return rb_ensure(trap, (VALUE)&arg, trap_ensure, (VALUE)&arg);
/* disable interrupt */
sigfillset(&fullmask);
pthread_sigmask(SIG_BLOCK, &fullmask, &arg.mask);
return rb_ensure(trap, (VALUE)&arg, trap_ensure, (VALUE)&arg);
}
#else
return trap(&arg);
#endif
@ -1014,15 +1018,17 @@ init_sigchld(int sig)
#if USE_TRAP_MASK
# ifdef HAVE_SIGPROCMASK
sigset_t mask;
sigset_t fullmask;
# else
int mask;
int fullmask;
# endif
#endif
#if USE_TRAP_MASK
/* disable interrupt */
sigfillset(&mask);
pthread_sigmask(SIG_BLOCK, &mask, &mask);
sigfillset(&fullmask);
pthread_sigmask(SIG_BLOCK, &fullmask, &mask);
#endif
oldfunc = ruby_signal(sig, SIG_DFL);