aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-01-12 01:36:35 +0000
committerUlrich Drepper <drepper@redhat.com>2002-01-12 01:36:35 +0000
commitdb298de5c5059585bcbd0d461c337ea92aa62336 (patch)
treea4d907a74bd7ed44a9d977ee1c3c19d51281614f
parent6c69f24aa872c0b722f3f77e1e060cf6c8872b34 (diff)
downloadglibc-db298de5c5059585bcbd0d461c337ea92aa62336.zip
glibc-db298de5c5059585bcbd0d461c337ea92aa62336.tar.gz
glibc-db298de5c5059585bcbd0d461c337ea92aa62336.tar.bz2
(sighandler): Initialize all elements to SIG_ERR. (__sigaction): Don't use value from sighandler if it is SIG_ERR.
-rw-r--r--linuxthreads/signals.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/linuxthreads/signals.c b/linuxthreads/signals.c
index 8a0dabf..5a1025e 100644
--- a/linuxthreads/signals.c
+++ b/linuxthreads/signals.c
@@ -74,7 +74,7 @@ static union
{
arch_sighandler_t old;
void (*rt) (int, struct siginfo *, struct ucontext *);
-} sighandler[NSIG];
+} sighandler[NSIG] = { [1 ... NSIG - 1] = { (arch_sighandler_t) SIG_ERR } };
/* The wrapper around user-provided signal handlers */
static void pthread_sighandler(int signo, SIGCONTEXT ctx)
@@ -157,10 +157,14 @@ int __sigaction(int sig, const struct sigaction * act,
return -1;
if (sig > 0 && sig < NSIG)
{
- if (oact != NULL)
+ if (oact != NULL
+ /* We may have inherited SIG_IGN from the parent, so return the
+ kernel's idea of the signal handler the first time
+ through. */
+ && (__sighandler_t) sighandler[sig].old != SIG_ERR)
oact->sa_handler = (__sighandler_t) sighandler[sig].old;
if (act)
- /* For the assignment is does not matter whether it's a normal
+ /* For the assignment it does not matter whether it's a normal
or real-time signal. */
sighandler[sig].old = (arch_sighandler_t) act->sa_handler;
}