This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
When sigaction in libpthread is called the first time for a signal we don't know whether the old signal handler is SIG_DFL or SIG_IGN, so we must return the value that the kernel reports. Andreas. 2002-01-11 Andreas Schwab <schwab@suse.de> * signals.c (sighandler): Initialize all elements to SIG_ERR. (__sigaction): Don't use value from sighandler if it is SIG_ERR. --- linuxthreads/signals.c.~1.22.~ Tue Apr 17 10:56:07 2001 +++ linuxthreads/signals.c Fri Jan 11 13:12:39 2002 @@ -74,7 +74,7 @@ { 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 @@ 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; } -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE GmbH, Deutschherrnstr. 15-19, D-904229 Nürnberg Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |