From f17fc04c70d3c02bd3781d3834fbb8b0be0a8b33 Mon Sep 17 00:00:00 2001 From: Paul Ackersviller Date: Sun, 18 Nov 2007 19:42:41 +0000 Subject: Merge of 23364: fix race in POSIX signal blocking - use local variables as other forms already do. --- Src/signals.c | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) (limited to 'Src/signals.c') diff --git a/Src/signals.c b/Src/signals.c index 7885210cf..0f541b3da 100644 --- a/Src/signals.c +++ b/Src/signals.c @@ -190,15 +190,6 @@ signal_mask(int sig) /* Block the signals in the given signal * * set. Return the old signal set. */ -/**/ -#ifdef POSIX_SIGNALS - -/**/ -mod_export sigset_t dummy_sigset1, dummy_sigset2; - -/**/ -#else - /**/ #ifndef BSD_SIGNALS @@ -207,7 +198,11 @@ signal_block(sigset_t set) { sigset_t oset; -#ifdef SYSV_SIGNALS +#ifdef POSIX_SIGNALS + sigprocmask(SIG_BLOCK, &set, &oset); + +#else +# ifdef SYSV_SIGNALS int i; oset = blocked_set; @@ -217,7 +212,7 @@ signal_block(sigset_t set) sighold(i); } } -#else /* NO_SIGNAL_BLOCKING */ +# else /* NO_SIGNAL_BLOCKING */ /* We will just ignore signals if the system doesn't have * * the ability to block them. */ int i; @@ -229,7 +224,8 @@ signal_block(sigset_t set) signal_ignore(i); } } -#endif /* SYSV_SIGNALS */ +# endif /* SYSV_SIGNALS */ +#endif /* POSIX_SIGNALS */ return oset; } @@ -237,19 +233,17 @@ signal_block(sigset_t set) /**/ #endif /* BSD_SIGNALS */ -/**/ -#endif /* POSIX_SIGNALS */ - /* Unblock the signals in the given signal * * set. Return the old signal set. */ -#ifndef POSIX_SIGNALS - sigset_t signal_unblock(sigset_t set) { sigset_t oset; - + +#ifdef POSIX_SIGNALS + sigprocmask(SIG_UNBLOCK, &set, &oset); +#else # ifdef BSD_SIGNALS sigfillset(&oset); oset = sigsetmask(oset); @@ -279,12 +273,11 @@ signal_unblock(sigset_t set) } # endif /* SYSV_SIGNALS */ # endif /* BSD_SIGNALS */ +#endif /* POSIX_SIGNALS */ return oset; } -#endif /* POSIX_SIGNALS */ - /* set the process signal mask to * * be the given signal mask */ -- cgit 1.4.1